![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
simcoweb
Members-
Posts
1,104 -
Joined
-
Last visited
Everything posted by simcoweb
-
he could also use if ($num_rows == 1) {
-
Thanks, jesirose.. my fingers got ahead of me :)
-
You're missing a closing } to your first 'else' statement. Put it just before your closing ?> php tag.
-
Problems validating form info before inserting into db!
simcoweb replied to jackie11's topic in PHP Coding Help
I need to type faster, Orio ;) -
Problems validating form info before inserting into db!
simcoweb replied to jackie11's topic in PHP Coding Help
Ok, I think I understand. This bit of code confuses me, however: [code]<?php if (count($errors) < 1) { } else { $msg = "<p class=\"error\">The following errors have occurred: " . implode('<br />', $errors) . "</p>\n"; } } ?>[/code] Basically what it's saying is IF the number of errors is less than 1... blah blah. But the blah blah doesn't get to happen because you immediately 'else' it. It's in place of the 'else' that you would execute your error display code then after that you'd 'else' it. -
Problems validating form info before inserting into db!
simcoweb replied to jackie11's topic in PHP Coding Help
Personally i've not seen where the line can end with a curly bracket instead of the required ; Here's the format I use for errors and it never has an issue: [code]<?php if ($username=="") { $err.= "Please provide a username<br/>"; } if (!$email) { $err.= "Please provide your email address<br>"; } if ($email) { if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { $err.= $email. " is not a valid email address.<br/>"; } } if ($password=="") { $err.= "Please provide password<br/>"; } if ($confirmPass=="") { $err.= "Please confirm your password.<br/>"; } if ($confirmPass != $password) { $err.= "Your passwords do not match. Please re-enter your passwords."; } ?>[/code] etc. etc. Notice it is checking several things like IF it's empty or IF it doesn't match, etc. -
I was gonna say, personally i've not seen that 'if' statement written in that format. Here's what I use; $num_rows = mysql_num_rows($result); if ($num_rows => 0) { echo "Our database shows this username has already been registered. Please choose another username."; } else { echo "WORKING!"; } Also, your mysql connection is missing one vital ingredient. The database name: mysql_select_db("database_name");
-
You're missing a { here: [code]if(0 != mysql_num_rows($result)) [b]{[/b][/code] And that's assuming you adapted c4onastick's changes also as that open 'if' statement will produce another error. If statements always have code to run and that code is between curly's: if ($this_does_not_work == true) { echo "This does not work"; }
-
I believe what you need is this function: strtotime() which converts dates to timestamp format. http://us3.php.net/strtotime
-
Ok, I see that now. Learn something new each day! :)
-
Hi. I'm a bit confused with the code since it appears that your form drop down selector is going to have one big choice of all three of those options in one option. $pulldown1 = '<option>Select One</option>'; Then two lines down you concatenate it with two other choices: $pulldown1 .= "<option value=\"{$row['order_number']}\">{$row['order_number']}) {$row['test_ordered']}</option>\n"; If I read this right it will produce a display of one option containing all three choices. Or maybe i'm not reading that right? Getting information displayed about a particular row (or in this case a particular person) only requires you have the query specify a unique identifier...like an 'id' field. [code]$query1 = "SELECT * FROM orders WHERE id='$id' ";[/code] Where the 'id' is passed in your search form. Or, the order_id or whatever you want to search by. Make sense? Then, that query would work like this: [code]<?php $query1 = "SELECT * FROM orders WHERE id='$id' "; $results = mysql_query($query1); echo "<table><tr> <th>Field 1</th><th>Field 2</th><th>Field 3</th><th>Field 4</th> </tr>"; while ($row = mysql_fetch_array($results)) { echo "<tr><td>" . $row['field1'] . "</td><td>" . $row['field2'] . "</td><td>" . $row['field3'] . "</td><td>" . $row['field4'] . "</td> </tr>"; } echo "</table>\n"; ?> [/code] That will produce a table with field names at the top (the <th> tags) and a row for each result (presumably one row).
-
[SOLVED] Delete query not working, though....
simcoweb replied to kernelgpf's topic in PHP Coding Help
Can we see it, pretty please? ;) -
Groovy.. good luck!
-
Try taking the '.' 's out of your extension array.
-
[SOLVED] Delete query not working, though....
simcoweb replied to kernelgpf's topic in PHP Coding Help
Ok, where is the session variable being transferred to? There's no mention of a session_start(); in the posted. code. Is it in the header file? -
Ok, in the 2nd and 3rd pages you need to add the 'name' attribute to the fields. If you have 'globals' turned on use this method: <input type='hidden' name='username' value='<?php echo $username;?>'> If turned off then this method: <input type='hidden' name='username' value='<?php echo $_POST['username'];?>'>
-
Am I missing something here or should those escape characters be "\" backslashes instead of "/" 's ?
-
After step one when they get to step two are these two variables getting populated? <?php echo $_POST["fname"]; ?> <?php echo $_POST["sname"]; ?>, Welcome To One Time Deals<br />
-
Are you getting a specific error?
-
Judging from your $query, you're getting this info from a form? If so, just post the variables ahead of your while loop so you can use them again: $banner = $_POST['banner']; Then you can echo it anywhere.
-
If i'm understanding correctly, you are hosting images for people and you want to provide them with the url to their image?
-
'NULL' is not a value. That's a setting. Strip out the reference to your non-used table fields and simply have the INSERT specify just the info field. [code] <? $info = $_POST["info"]; include("dbconnect.php"); $profile=MYSQL_QUERY("INSERT INTO account 'info' VALUES '$info "); echo("Profile updated!"); ?>[/code]
-
Yep, we learn something new everyday here :)
-
Do you HAVE to use Iframes? You can simply 'include' the PHP files into the page(s) with creating an IFrame.