PHP Mysql and 50 queries and blank page without any error

  • httpftp21
  • Graduate
  • Graduate
  • httpftp21
  • Posts: 101

Post 3+ Months Ago

Hi All,
I am using PHP as server side scripting and Mysql as backend
At on page i require 50 queries (Select, Insert and Update) to be executed to satisfy client requirement.
Now the problem is tht i was able to execute this stuff when the site was hosting on rackspace.
But now the servers has chnaged and the problem started.
When i execute this page, 1 out of 5 request i get a blank page without any error.
i dont wht's happening but i get blank page without any error.
No errors in mysql error log neither in php error log.
So i am bit confused.

Currently i am working the following few things to fix this problem:-
1. After each query i am writing a file tht this query was executed.
So tht i can know which query is causing issue.
2. Stored procedure I am not a master of it but i guess tht will
avoid mutiple connections thru PHP
3. Or Write all the data to a file and excute it thru cron running
every sec. (Thts ugly but i cant help)
4. Increase php execution time for tht page thru php_ini.

Ur Views please ??
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8485
  • Loc: USA

Post 3+ Months Ago

One, I think that's too much SQL queries... you might like to look into joining some queries and shortening down the queries per page.

Second, try adding the following for every mysql_query($sql);...
PHP Code: [ Select ]
$result = mysql_result($sql) or die('There was an error ' . mysql_error());
  1. $result = mysql_result($sql) or die('There was an error ' . mysql_error());

You can also look into this tutorial.
  • joebert
  • Genius
  • Genius
  • User avatar
  • Posts: 13511
  • Loc: Florida

Post 3+ Months Ago

Rig the script to dump all of the SQL queries that will be executed to a file.

Execute the queries, bypassing PHP, via SSH.
Code: [ Select ]
mysql -uuser -ppassword < '/path/to/file.sql'

If it runs without error you can rule out MySQL issues such as syntax changes between versions.

Increase the time PHP has to finish the job. It appears you know how to do that.

I think the problem has something to do with either of those two off the top of my head.
Not everyones works this way, but I know my server doesn't give me MySQL errors when using PHP unless I ask for them with one of the error functions.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 16 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.