jabsalud
-
Posts
33 -
Joined
-
Last visited
Posts posted by jabsalud
-
-
Sure, go ahead, StephenM. Sounds exciting.
Also, jabsalud, sorry for making the wrong assumption. The way you phrased everything made it sound like it was a school assignment or something. That's why I was a bit apprehensive to answer before.
Anyway, StephenM, if your solution works, great, but I think the following is much simpler:
<?php for ($i = 0; $i < 8; $i++) { echo (($i % 2 === 0) ? $i * 2 : -$i - 1) . '<br>'; }
thanks stephenM and hartleysan i really appreciate your works, your codes work perfect thanks again
-
no its not an assignment. i have tried it but the output is this
+2
0
4
8
12
+4
0
4
8
12
+6
0
4
8
12
+8
0
4
8
12
so what i am asking is i cant separate the loop that will increment by 4. what i wanted to do is to alternate them by two's as i have given the output. its not an assignment trust me. all im asking is for your help i need the actual code to compare to my answer. anyone of you could help me? its just an example and part of my studying the "nested loops".
-
im sorry mates i gave a wrong output, let's change it to this
0+
-2
4+
-4
8+
-6
12+
-8
create a loop that will increment by two and another loop that will increment by four, use for loop. please help me with this example. thanks mates.
-
@Hartley San, yes that is exactly. could you please help me to code it? im doing it in for loops but with no success.
thanks mate.
-
helo i'm doing my logical exercises and i'm getting hard to solve this output using for loops
2
1
4
3
6
6
8
9
i need your help could you please post your codes? i need to understand nested loops.
-
ooh my friend tells me about the compatibility of jquery in ie browser and i dont know that you can do that using javascript. i should probably consider larry's modern javascript book. thanks hartleysan
-
ah so kind of saying that once you are learning ajax you also learning jquery? am i right?
-
hi sir before considering this book i have one question. have you also covered jquery, ajax here? i mean discussed it in clear? or just focusing on javascript? i'm sorry for this question but i'm completely new to this language. I have browsed the net and some forums giving me advice to learn jquery and ajax. so i am wondering if you discussed it clearly too in this book. many thanks sir
example like topics in making modal form in jquery something like that.
-
hey sir is the topic about modal forms discussed in this book?
-
hey folks im wondering if jquery is the same as ajax? any answer to that?
-
how about handling multiple submit buttons in php?
I have come across scripts that use:
isset($_POST['submit'])
as well as code that uses:
$_SERVER['REQUEST_METHOD']=='POST'
which is better to use? my situation is having two submit button in one php script. since that i cant use the 2nd one in verifying what form is being submitted should this be mean the first one is better?
-
i'm currently confused on how to resized an image without losing its quality. for example i have 1920x1080 picture and i resized it to 400x225 i am bit satisfy as it succeeded but the things is that, the picture losed its resolution. my formula is here: new height = (original height/original width) * new width and vice versa. while maintaining the aspect ratio i noticed that the resolution degrades and get pixelated. any advice sir?
-
mysql returns an error on an update query if nothing has been updated. How this scenario is handled for the user is a developer decision. You can trap the error and handle it in a user friendly way or you can give the user an opt out button.
larry's code in chapter 13 in section under edit. it works perfectly even i dont change the retrieved information at all. my concern is in chapter 12 it cannot done the same. it seems like there is something on larry's chapter'12 code an error? but if i edit it it works perfectly. argh! i'm stuck! in chapter 12.
-
is there someone there tried not to change the retrieved title and entry and hit update button and get an error?
when i run the code and did some changes it goes perfectly but when i did not make any change to the retrieved title and entry it says an error. the thing is that when i make some changes it works but when i choose not to make any changes and hit "update this entry" it says an error. isn't that the problem is you have too make an actual change? what i mean is that once i click edit i should change it atleast one letter or put space so i can update it? what if i decided not to change anything and click update?
-
thanks for the reply guys especially to you Antonio Conte. you gave me an idea and i'll research on that.
-
yeah i have red this before and its really good ,it taught me alot about php and mysql and now i am looking forward to take it to more advance. my very concern here is how will you connect the same database you use in programming application. for example you are programming visual basic and you use mysql as its database how will you connect that database to also use in php web developing. what i mean here is that the database is in your local computer and i want my www.example.com to fetch all informations inputted in my local computer at my home. how can i do that?
-
Yes, this is PHP and MySQL 101. This is very easy to do, and Larry talks a lot about it in the book this forum is about. To buy the book, check out the following link:
http://www.amazon.co...rds=PHP + MySQL
By the way, this book is excellent, and is the one I primarily used to learn PHP and MySQL.
-
hey sir i'm thinking of developing an application with mysql as it's database, i'm wondering if how can i connect that database to my php website? for example i am inputting data on my application (that's on my computer) and saved it. and latter on i want that information to be present on my website too. just like one computer application and a web application sharing at one database. so my question is, have you discussed this on your books? any advice regarding to this topic sir? thank you.
-
hi sir
In the php.ini, I would use the "From" address that you know works in Thunderbird. You can play with different "From" addresses in the PHP script, then. Also try different "To" addresses, starting with the one you knew worked from Thunderbird.
hi sir i am having a problem. the activation message which i received in my thunder bird is successful however when i click the generated link "http://www.example.c...29aa192acc379b7" it forwards me to the this site "http://www.iana.org/domains/example/" even though in my script i wrote this "$body .= BASE_URL . 'activate.php?x=' . urlencode($e) . "&y=$a";" what might be the problem? if i cant fix it i think i cant make to it next topic because i cant activate the account created and cant login.
-
So what happens when you reply to a current thread? Do you still get an error?
I tried my post.php in response to a thread and to post a new thread and both were working. Did you setup the database and fill it in with the sample data that was provided in the sql file download for chap 17?
i got it i just mispelled posts to post hooh problem was resolved! but i was still in the error of no showing the dates under "posted on" and "latest reply" what steps should i do to resolve this? i even tried copy paste the timezone ,the one i downloaded in mysql site, in this address "c:\wamp\bin\mysql" what was wrong then?
-
I finished the message board example it all worked on my localhost. Which script are you encountering the problem on, can you print us out the php error you are receiving?
<?php # Script 17.7 - post.php
// This page handles the message post.
// It also displays the form if creating a new thread.
include ('includes/header.html');
if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Handle the form.
// Language ID is in the session.
// Validate thread ID ($tid), which may not be present:
if (isset($_POST['tid']) && filter_var($_POST['tid'], FILTER_VALIDATE_INT, array('min_range' => 1)) ) {
$tid = $_POST['tid'];
} else {
$tid = FALSE;
}
// If there's no thread ID, a subject must be provided:
if (!$tid && empty($_POST['subject'])) {
$subject = FALSE;
echo '<p>Please enter a subject for this post.</p>';
} elseif (!$tid && !empty($_POST['subject'])) {
$subject = htmlspecialchars(strip_tags($_POST['subject']));
} else { // Thread ID, no need for subject.
$subject = TRUE;
}
// Validate the body:
if (!empty($_POST['body'])) {
$body = htmlentities($_POST['body']);
} else {
$body = FALSE;
echo '<p>Please enter a body for this post.</p>';
}
if ($subject && $body) { // OK!
// Add the message to the database...
if (!$tid) { // Create a new thread.
$q = "INSERT INTO threads (lang_id, user_id, subject) VALUES ({$_SESSION['lid']}, {$_SESSION['user_id']}, '" . mysqli_real_escape_string($dbc, $subject) . "')";
$r = mysqli_query($dbc, $q);
if (mysqli_affected_rows($dbc) == 1) {
$tid = mysqli_insert_id($dbc);
} else {
echo '<p>Your post could not be handled due to a system error.</p>'; "this is the result when i tried to submit it what might be the problem?"
}
} // No $tid.
if ($tid) { // Add this to the replies table:
$q = "INSERT INTO posts (thread_id, user_id, message, posted_on) VALUES ($tid, {$_SESSION['user_id']}, '" . mysqli_real_escape_string($dbc, $body) . "', UTC_TIMESTAMP())";
$r = mysqli_query($dbc, $q);
if (mysqli_affected_rows($dbc) == 1) {
echo '<p>Your post has been entered.</p>';
} else {
echo '<p>Your post could not be handled due to a system error.</p>';
}
} // Valid $tid.
} else { // Include the form:
include ('includes/post_form.php');
}
} else { // Display the form:
include ('includes/post_form.php');
}
include ('includes/footer.html');
?>
-
hey sir i just got a little problem here, when im trying to post the message, although it runs smoothly, it prompts " Your post could not be handled due to a system error.". that happens when i am creating a new thread, it seems like the queries dont work? any idea about that sir? and also for the remedy?
-
hey sir i have a question why is it necessary to use return value in a function instead of using echo or print?
-
thanks for responding sir
Forms In Javascript Or Php?
in Modern Javascript: Develop and Design
Posted
does that means javascript's sole purpose is to add interactivity for your site? so that it makes your website more beautiful?