aaronlzw_21 Posted May 2, 2006 Share Posted May 2, 2006 hi i need help. the codes i written to connect to a database (MySQL) can't be executed. i'm not sure y. this is my codes. i did a echo 'testing'; juz before "@ $db= mysql_pconnect("localhost", "root","password");" it shows out "testing". however, if i do a echo 'testing'; after "@ $db= mysql_pconnect("localhost", "root","password");" it doesn't show anything. it appears that the codes are not executed after that line. am i coding anything wrongly? please correct me.. thanks alot..<table width="80%" border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <td width="40%"><div align="right"><strong>Site:</strong></div></td> <td width="60%"><strong> <?php @ $db= mysql_pconnect("localhost", "root","password"); if (!$db){ echo 'Error: unable to connect to database. Please try again later.'; exit; } mysql_select_db('psarecords'); $query= "select site from tblsite"; $result= mysql_query($query); $num_results = mysql_num_rows($result); echo '<select name="ListSite" id="ListSite">'; echo "<option>--------</option>"; for ($i=0; $i <$num_results; $i++) { $row=mysql_fetch_array($result); echo '<option>'& $row['site'] & '</option>'; } echo '</select>'; ?> </strong></td>oh ya by the way, i'm running apache and mySQL 5. thanks alot! Quote Link to comment https://forums.phpfreaks.com/topic/8878-php-cant-connect-to-mysql/ Share on other sites More sharing options...
moberemk Posted May 2, 2006 Share Posted May 2, 2006 If you're working with Dreamweaver, why don't you just use the Dreamweaver features to recreate that connection and data? Quote Link to comment https://forums.phpfreaks.com/topic/8878-php-cant-connect-to-mysql/#findComment-32575 Share on other sites More sharing options...
aaronlzw_21 Posted May 2, 2006 Author Share Posted May 2, 2006 [!--quoteo(post=370515:date=May 2 2006, 07:11 PM:name=moberemk)--][div class=\'quotetop\']QUOTE(moberemk @ May 2 2006, 07:11 PM) [snapback]370515[/snapback][/div][div class=\'quotemain\'][!--quotec--]If you're working with Dreamweaver, why don't you just use the Dreamweaver features to recreate that connection and data?[/quote]ya i've tried doin that.. it keeps saying error. don't know wats wrong wif it.. my mysql works fine. somehow the php codes can't connect to it.. Quote Link to comment https://forums.phpfreaks.com/topic/8878-php-cant-connect-to-mysql/#findComment-32625 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.