Jump to content

Recommended Posts

Hey all I just replaced all our main gateways that house all our LAN based office PHP Apps I have made and the issue is that database parsing is not working like they did on the older systems. I currenly have PHP 5.3.3 and MySQL 5.1.66 and the code is outputting this on the screen rather then the $row[x] from the database. I'm sure this is a simple fix in the configuration somewhere to get these pages working again on the new setup.

 

Annual Discount Card Purchases:
'.$row[2].', '.$row[1].'
' ; } // Close Database Connection mysql_close(); ?>

Gift Certificate Purchases:
'.$row[1].' :: '.$row[12].' :: '.$row[13].' :: '.$row[14].'
' ; } // Close Database Connection mysql_close(); ?>

 

Any help getting this to parse the data correcly and not print my code would be excellent. Remember nothing about the old working code has changes this is simple running the old PHP files on MUCH newer PHP and MySQL Versions.

 

Best regards,

 

TRI0N!

Link to comment
https://forums.phpfreaks.com/topic/272194-phpmysql-new-server-help-asap/
Share on other sites

Here is what the PHP code looks like that outputs the above into the page when viewed:

 

<?
// Database Connection
mysql_connect("$dbhost","$dbuser","$dbpasswd") ;
// Database Selection
mysql_select_db("$dbname3") ;
// Check Events in Events Database
$result1 = mysql_query("select distinct * from cdc_sales WHERE processed = '0'") ;
while($row = mysql_fetch_row($result1)) {
echo '<a href="purchase_details.php?id='.$row[0].'">'.$row[2].', '.$row[1].'</a><br>' ;
}
// Close Database Connection
mysql_close();
?>
</td>
 </tr>
 <tr>
   <td> </td>
 </tr>
 <tr>
   <td>Gift Certificate Purchases:</td>
 </tr>
 <tr>
   <td>
<?
// Database Connection
mysql_connect("$dbhost","$dbuser","$dbpasswd") ;
// Database Selection
mysql_select_db("$dbname3") ;
// Check Events in Events Database
$result2 = mysql_query("select distinct * from gift_certs WHERE processed = '0'") ;
while($row = mysql_fetch_row($result2)) {
echo '<a href="purchase_gc_details.php?id='.$row[0].'">'.$row[1].' :: '.$row[12].' :: '.$row[13].' :: '.$row[14].'</a><br>' ;
}
// Close Database Connection
mysql_close();
?>

 

Best regards,

 

TRI0N

If you check the source of that page, I'm willing to bet that you'll see the PHP code. Which means the PHP parser haven't been executed, and the web server (if the file has been fetched through it) has treated the file as pure HTML. This is normally either because of an incorrect configuration of the server, failure to restart it after setting up PHP, or forgetting to set the file extension to "php".

 

Edit, added:

Or using short tags when they're disabled. Replace them with the full <?php tags.

Edited by Christian F.

Yep that was it.. php.ini is setup for strict PHP and the Tags where the reason. Good reason to. I will just go back into my work and make sure all tags are pressent. Thanks a ton PFMaBiSmAd!

 

I knew my php setup was good and very secured so missing the tags threw me off.

You have to find the cause of the problem before you can fix it. Otherwise you just waste a bunch of time.

 

By trying full opening php tags in that code, it will confirm if that is the cause of the problem.

 

Edit: never mind, you posted while I was writing this and the forum's post notification is a -10 likes.

Edited by PFMaBiSmAd
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.