![]() |
| ||
| a little help I'm trying to get this script to work and it is only giving me a blank white page, can someone take a look at it and see if you can tell whats wrong with it. <?phpI must be missing something simple but I just can't find it. This is a form to update a record in a MySQL database. Thanks. |
| ||
| Re: a little help add this before the while(): if(mysql_num_rows($result)<1) {
This will determine if the query is returning a result |
| ||
| Re: a little help No, still same result. Here is how I put it in: if(mysql_num_rows($result)<1) {
I thought it looked like it needed one more closing bracket (}) after the echo but that didn't improve anything either. |
| ||
| Re: a little help add error_reporting(E_ALL);to the top of the page to override any php.ini config which may be blocking errors from displaying. |
| ||
| Re: a little help Still just a blank white screen. Hmm perplexing. |
| ||
| Re: a little help Do other PHP pages work? |
| ||
| Re: a little help It looks like you are missing one more } in your code. It seems like the one you put after the last echo closes your new while statement, but your else statement is still open. Also, in your original code you had 2 statements to execute queries.. was the 2nd for testing purposes? |
| ||
| Re: a little help Yes, all of my other scripts are running just fine. I took a look at the }'s and agree that it looks like there needs to be one more. I played with adding one but its not making any difference. I think i did have an extra $results in there as well and took that out. Here is what I have now. I've made so many changes now that I don't even remember what I started with :) In my while statement, some examples have shown to use fetch_row and some have fetch_assoc, I've got fetch_row in there now. : <?phpThis is getting frustrating. If I could get it to display something, i could work with it. The phoneupdate1.php file it is sending to displays fine but needs the info from this page. All i want to do is be able to change data in my MySQL database if anyone has a more simple way of doing it. Thanks for all your help guys. |
| ||
| Re: a little help A couple of problems with your current code: mysql_fetch_row returns a row in a numerical array, you would need to use $row[0], $row[1] for displaying the data, to use what you are, you will need to use mysql_fetch_assoc to call the cells by the column names. There is a slight problem here: if (mysql_num_rows($result) > 0) {
You have put it as this: If { While { End While } Else {} End If } It should be: if (mysql_num_rows($result) > 0) {
I'm afraid I cant see any other problems with the actual code, I suggest you also check the database and make sure that the column names are correct (they are case sensitive) and that there is actually data in the table you are using. |
| ||
| Re: a little help Ok, you got it there, i changed it to $row and included the row numbers instead of the names and it is now displaying the data I want. Thank you so much. Here is what I've got now: <?php This is how it displays with the word "Update" being a link to my update form: UpdateID : 4 First Name : Edward Last Name : ScissorHands Phone Number : xxx-123-456 Extension : 111 Title : Hedgetrimmer Department : Roads & Grounds Fax Number : So far so good, when i click on the update link, it takes me to my update form but does not display the data. Here is what it displays: Reference: Last Name :<? echo $row['lname']; ?> First Name :<? echo $row['fname']; ?> Phone Number :<? echo $row['phone_num']; ?> Extension :<? echo $row['ext']; ?> Title :<? echo $row['title']; ?> Department :<? echo $row['dept']; ?> Fax Number :<? echo $row['fax']; ?> SUBMIT BUTTON Here is the form it is using: <?php So now when i use this form does $id=$_POST['id'];need to reflect the $row[0] instead of the ['id'] as well? I'm not getting the data from the first form for some reason. |
| All times are GMT -4. The time now is 3:10 am. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC