By Robert Berkowitz on September 28, 2000 Example Let’s say you have a MySQL database that stores link submissions for sites of interest. In that database there is a table called submissions. The fields in the submissions table are as follows: SubmissionID PostedBy Link Description Approved You want to be…
PHP Tutorials
Whether just getting started or an expert, this vast collection of PHP tutorials will help you create dynamic content for powerful web-based applications in no time.
By Robert Berkowitz on September 28, 2000 <?php //This loops through all the records that have been displayed on the page. for ($index = 0; $index <= $counter; $index++) { /* This part sets a variable with the names we created in the first section. We start with 0 and go until the number saved in the $index_count variable. */ $varSubmissionID = ‘SubmissionID’.$index; $varPostedBy = ‘PostedBy’.$index; $varLink = ‘Link’.$index; $varDescription = ‘Description’.$index; $varApproved = ‘Approved’.$index; /* This is the variable variable section. We take the value that was assigned to each name variable. For example the first time through the loop we are at the record assigned with SubmissionID0. The value given to SubmissionID0 is set from the first section. We access this value by taking the variable variable of what SubmissionID0 is. */ $SubmissionIDvalue = $$varSubmissionID; $PostedByvalue = $$varPostedBy; $Linkvalue = $$varLink; $Descriptionvalue = $$varDescription; $Approvedvalue = $$varApproved; //Update the database $sql = “UPDATE submissions SET PostedBy=’$PostedByvalue’,Link=’$Linkvalue’,”. “Description=’$Descriptionvalue’ WHERE SubmissionID=$SubmissionIDvalue'”; $result = mysql_query($sql); //If the link was marked approved set the value of the Approved field if ($Approvedvalue == ‘-1′) { $sql = “UPDATE submissions SET Approved=’-1′ WHERE SubmissionID=$SubmissionIDvalue”; $result = mysql_query($sql); } } ?> I hope this has helped…
A long time ago in a place far far away, at least from my house, object oriented programming was invented. Included
A long time ago in a place far far away, at least from my house, object oriented programming was invented. Included
Last week we left off with an example where notice, exception and log levels are sent to the client. This week we
Last week we left off with an example where notice, exception and log levels are sent to the client. This week we
The hardest concept I’ve tried to understand since beginning to use PHP was that of classes. I’d never used a database engine but learning to use
The hardest concept I’ve tried to understand since beginning to use PHP was that of classes. I’d never used a database engine but learning to use
The hardest concept I’ve tried to understand since beginning to use PHP was that of classes. I’d never used a database engine but learning to use
The hardest concept I’ve tried to understand since beginning to use PHP was that of classes. I’d never used a database engine but learning to use