Re: How to Select
| From: | Kae Verens | Date: | Fri, 15 Aug 2003 09:09:31 +0000 |
| Subject: | Re: How to Select | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159657@lists.php.net to get a copy of this message | ||
John Taylor-Johnston wrote:
Ok, this is a basic MySQL question, but I don't know how to code it in PHP. I want to check in StudentId. If it exists, ...
Anyone good humoured who would help me fill in the blank. Like I should know this, but haven't even thought of coding SQL in a while :)
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query("select StudentId $table");
while ($mydata = mysql_fetch_object($news))
{
}
if exists
{do this}else{do that}
if(mysql_num_rows(mysql_query('select * from "'.$table.'" where
StudentId="'.$studentid.'"')){
// do this
}else{
// do that
}
Kae