stewart715 Posted October 21, 2006 Share Posted October 21, 2006 I need to a script that will do this in the following order1. connect to a db2. select PID from tableb where UID=$user->uid (current user)3. if PID =1 print YES if PID=2 print NOany suggestions? Link to comment https://forums.phpfreaks.com/topic/24636-very-simple-question-converting-data/ Share on other sites More sharing options...
.josh Posted October 21, 2006 Share Posted October 21, 2006 [code]<?php // 1. connect to a db $conn = mysql_connect('localhost','username','password') or die(mysql_error()); $db = mysql_select_db('dbname',$conn) or die(mysql_error()); // 2. select info $id = $user->uid; $sql = "select PID from tableb where UID=$id"; $result = mysql_query($sql, $conn) or die(mysql_error()); // 3. print yes or no $yesorno = mysql_fetch_assoc($result); switch ($yesorno[0]) { case 1 : echo "yes"; break; case 2 : echo "no"; break; default : echo "1 or 2 not found..some kind of error"; }?>[/code] Link to comment https://forums.phpfreaks.com/topic/24636-very-simple-question-converting-data/#findComment-112213 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.