Click here to Skip to main content
15,891,777 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: permission denied error Pin
James Simpson8-May-08 0:33
James Simpson8-May-08 0:33 
GeneralRe: permission denied error Pin
vicky000008-May-08 1:24
vicky000008-May-08 1:24 
GeneralRe: permission denied error Pin
James Simpson8-May-08 1:27
James Simpson8-May-08 1:27 
GeneralRe: permission denied error Pin
vicky000008-May-08 1:58
vicky000008-May-08 1:58 
GeneralRe: permission denied error Pin
James Simpson8-May-08 2:03
James Simpson8-May-08 2:03 
QuestionDotNetNuke4.8 Pin
Imthu7-May-08 18:28
Imthu7-May-08 18:28 
QuestionAJAX COMET Issue (IE7) Pin
James Simpson7-May-08 13:10
James Simpson7-May-08 13:10 
QuestionPHP + MySQL Timeout Error Pin
47_MasoN_477-May-08 10:23
professional47_MasoN_477-May-08 10:23 
I'm working on a script for my employer's website that will take form data and enter it into a MySQL database. Easy enough...until they wanted it to never have any gaps in the "id" field. They want the "id" field to be automatically generated and for it to never have any gaps in it if we decide to delete someone out of the database for whatever reason. To do this I wrote the following code (this isn't in it's entirety, just the pieces that are pertinent.)
$id = 0;<br />
$query = mysql_query("SELECT * FROM <tablename> ORDER BY id") or die(mysql_error());<br />
$row = mysql_fetch_array($query) or die(mysql_error());<br />
<br />
// This while loop checks the 'id' field and finds if there are any gaps, automatically<br />
// setting the $id variable to the smallest unused value<br />
<br />
while( $row['id'] = ($id + 1)){<br />
    $id += 1;<br />
}<br />
$id +=1;</tablename>

It looks to me that it should say "while the id field (1) = $id + 1 (1) then add 1 to $id and repeat until the id field doesn't = $id + 1 anymore." For some reason though, when I run the script from the website it just sits there until I get this error back from Firefox.

Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/www.website.com/htdocs/script.php on line 33

If I take the while statement out of the code and just have it echo back the values of $row['id'] and $id + 1 it brings back 1 and 1. But if I add the while loop in there it errors out again. I've tried while, do while, and if statements all to no avail.

My apologies for the lengthiness, but I wasn't sure how to make this more concise.
AnswerRe: PHP + MySQL Timeout Error Pin
Ashish Sehajpal8-May-08 0:23
Ashish Sehajpal8-May-08 0:23 
GeneralRe: PHP + MySQL Timeout Error Pin
47_MasoN_479-May-08 9:44
professional47_MasoN_479-May-08 9:44 
Questiongetting string from server script to Client script Pin
gangar7-May-08 7:35
gangar7-May-08 7:35 
AnswerRe: getting string from server script to Client script Pin
Ashish Sehajpal8-May-08 0:19
Ashish Sehajpal8-May-08 0:19 
GeneralRe: getting string from server script to Client script Pin
gangar8-May-08 3:26
gangar8-May-08 3:26 
GeneralRe: getting string from server script to Client script [modified] Pin
James Simpson8-May-08 4:02
James Simpson8-May-08 4:02 
GeneralRe: getting string from server script to Client script Pin
gangar8-May-08 4:46
gangar8-May-08 4:46 
GeneralRe: getting string from server script to Client script Pin
James Simpson8-May-08 4:56
James Simpson8-May-08 4:56 
GeneralRe: getting string from server script to Client script Pin
gangar9-May-08 3:18
gangar9-May-08 3:18 
QuestionIE 7 status bar hiding Pin
King Shez6-May-08 22:53
King Shez6-May-08 22:53 
AnswerRe: IE 7 status bar hiding Pin
47_MasoN_477-May-08 11:10
professional47_MasoN_477-May-08 11:10 
QuestionNeed a Upload Images html code for my site! Pin
Mary Gonzalez6-May-08 11:51
Mary Gonzalez6-May-08 11:51 
AnswerRe: Need a Upload Images html code for my site! Pin
Christian Graus6-May-08 11:57
protectorChristian Graus6-May-08 11:57 
Question[Message Deleted] Pin
Macorina6-May-08 10:42
Macorina6-May-08 10:42 
AnswerRe: Help me out Pin
Christian Graus6-May-08 11:56
protectorChristian Graus6-May-08 11:56 
QuestionVS2008 ASP2.0 Treeview Context menu c# [modified] Pin
peter.bellen@qsm-europe.com6-May-08 10:28
peter.bellen@qsm-europe.com6-May-08 10:28 
AnswerRe: VS2008 ASP2.0 Treeview Context menu c# Pin
tonymathewt20-May-08 23:09
professionaltonymathewt20-May-08 23:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.