Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
Unisa contact information | 07/28/2011 01:28PM |
error checking March 14, 2013 08:12AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Language: PHP$mail=mysql_query("SELECT * from course_student WHERE fmark is NULL"); echo $mail; //this is a test $nummail = mysql_num_rows($mail); echo $nummail; //this is a test - if you know there is a row and this shows no row, then you know your query is wrong
Language: PHP$sel=$_POST[';sel';]; $count = count($sel); //echo $count; for ($ar = 0; $ar < $count; $ar++) { $getit= "$sel[$ar]"; //assign it a name $rest = substr("$getit", 8, -1); //substring it to remove stuff $pieces = explode("/", $getit); //split the remaining $fid=$pieces[0]; // piece1 the fixt id $ref_id=$pieces[1]; // piece2 the ref id //echo "$sel $count $ref_id -> $fid<br>";
Re: error checking March 14, 2013 10:20AM |
Registered: 11 years ago Posts: 163 Rating: 0 |
Re: error checking March 14, 2013 10:31AM |
Registered: 11 years ago Posts: 167 Rating: 0 |
Re: error checking March 14, 2013 04:02PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Language: PHP// here is some sample code showing the trick on how to get the information into a table <?php include (';config.php';); //connection details to the database in a connect.php page echo "<table border=';1';><tr bgcolor=';#cccccc';><td>Book title</td><td>Authorname</td><td>Author surname</td><td>Price</td><td colspan=';2';>Action</td></tr>"; //put the table header column outside the loop ……//query statement here while($row = mysql_fetch_array($result)){ // the loop part of your query ... get info from db e.g, title, auth_name etc. echo "<tr><td>"; //here is the trick - > put the table rows inside the loop, and draw the information from the db into a table row, one at a time, which you can do because cause it is a while (loop) echo $row[';title';]; echo "</td><td>"; echo $row[';auth_name';]; echo "</td><td>"; echo $row[';auth_surname';]; echo "</td><td>"; echo $row[';price';]; echo "</td><td>"; echo "<a href=edit.php?book_id=$book_id&update=yes>Edit</a>"; echo "</td><td>"; echo "<a href=delete.php?book_id=$book_id&delete=yes>Delete</a>"; echo "</tr>"; } echo "</table>"; //end the table outside the loop
Re: error checking March 14, 2013 04:31PM |
Registered: 11 years ago Posts: 167 Rating: 0 |
Re: error checking March 19, 2013 10:09PM |
Registered: 11 years ago Posts: 56 Rating: 0 |
Re: error checking March 21, 2013 01:18PM |
Registered: 11 years ago Posts: 51 Rating: 0 |
Re: error checking March 22, 2013 10:56PM |
Registered: 12 years ago Posts: 106 Rating: 0 |
Re: error checking March 23, 2013 04:53AM |
Registered: 11 years ago Posts: 20 Rating: 0 |
Re: error checking March 26, 2013 04:55AM |
Registered: 11 years ago Posts: 25 Rating: 0 |
Re: error checking March 26, 2013 07:37AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: error checking March 26, 2013 08:43AM |
Registered: 11 years ago Posts: 70 Rating: 0 |
Re: error checking March 26, 2013 11:32AM |
Registered: 11 years ago Posts: 131 Rating: 0 |
Which one gives an error? Print is best for evaluating the outcome of an output statement.Language: PHPecho(';one';, ';two';); print(';one';, ';two';);
Re: error checking March 26, 2013 02:46PM |
Registered: 11 years ago Posts: 68 Rating: 0 |
Re: error checking March 26, 2013 04:31PM |
Registered: 11 years ago Posts: 70 Rating: 0 |
Re: error checking March 26, 2013 04:45PM |
Registered: 11 years ago Posts: 68 Rating: 0 |
Re: error checking March 26, 2013 04:48PM |
Registered: 11 years ago Posts: 51 Rating: 0 |
Re: error checking April 02, 2013 10:50AM |
Registered: 11 years ago Posts: 29 Rating: 0 |
Re: error checking April 02, 2013 10:59AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: error checking April 02, 2013 11:02AM |
Registered: 11 years ago Posts: 6 Rating: 0 |
Re: error checking April 02, 2013 11:33AM |
Registered: 11 years ago Posts: 70 Rating: 0 |
Re: error checking April 02, 2013 11:53AM |
Registered: 11 years ago Posts: 6 Rating: 0 |
Re: error checking April 02, 2013 05:55PM |
Registered: 11 years ago Posts: 29 Rating: 0 |
Re: error checking April 10, 2013 02:49PM |
Registered: 11 years ago Posts: 6 Rating: 0 |
Re: error checking May 01, 2013 12:14AM |
Registered: 11 years ago Posts: 20 Rating: 0 |
Language: PHP<?php $link = mysql_connect("localhost","root","") or die(mysql_error()); mysql_select_db("moviesite") or die (mysql_error()); $query = "SELECT movie_name, movie_director, movie_leadactor " . "FROM movie"; $result = mysql_query($query, $link) or die(mysql_error()); $num_movies = mysql_num_rows($result); $movie_header=<<<EOD <h2><center>Movie Review Database</center></h2> <table width="70%" border="1" cellpadding="2" cellspacing="2" align="center"> <tr> <th>Movie Title</th> <th>Movie Director</th> <th>Movie Lead Actor</th> </tr> EOD; function get_director() { global $movie_director; global $director; $query_d = "SELECT people_fullname " . "FROM people " . "WHERE people_id=';$movie_director';"; $results_d = mysql_query($query_d) or die(mysql_error()); $row_d = mysql_fetch_array($results_d); extract($row_d); $director = $people_fullname; } function get_leadactor() { global $movie_leadactor; global $leadactor; $query_a = "SELECT people_fullname " . "FROM people " . "WHERE people_id=';$movie_leadactor';"; $results_a = mysql_query($query_a) or die(mysql_error()); $row_a = mysql_fetch_array($results_a); extract($row_a); $leadactor = $people_fullname; } while ($row = mysql_fetch_array($result)) { $movie_name = $row[';movie_name';]; $movie_director = $row[';movie_director';]; $movie_leadactor = $row[';movie_leadactor';]; //get director';s name from people table get_director(); //get lead actor';s name from people table get_leadactor(); $movie_details .=<<<EOD <tr> <td>$movie_name</td> <td>$director</td> <td>$leadactor</td> </tr> EOD; } $movie_details .=<<<EOD <tr> <td>Total :$num_movies Movies</td> </tr> EOD; $movie_footer ="</table>"; $movie =<<<MOVIE $movie_header $movie_details $movie_footer MOVIE; echo "There are $num_movies movies in our database"; echo $movie; ?>
Re: error checking May 01, 2013 05:25PM |
Registered: 11 years ago Posts: 131 Rating: 0 |
Re: error checking May 02, 2013 01:33AM |
Registered: 11 years ago Posts: 20 Rating: 0 |