Hi php friends,
I'll be very thankful to hear your opinion my php problem:
I have a php website with mysql database with 1 table with about 20,000 rows.
My code looks like this:
$mysqli = new mysqli($mysql_hostname, $mysql_user, $mysql_password, $mysql_database); if ($mysqli->connect_errno) { exit(); }
if ($stmt = $mysqli->prepare('SELECT title, description, content FROM '.$tableName.' WHERE slug=?')) { $stmt->bind_param("s", $slug); $stmt->execute(); $stmt->bind_result($title, $description, $content); $stmt->fetch(); $stmt->close(); } $mysqli->close();
...
/* just visualize the read variable above */
<h1><?php echo $title; ?></h1> <?php echo $content; ?>
The problem is that in the hosting statistic, there's really huge php CPU usage, i.e. for yesterday the statistic is:
PHP CPU usage is 144 min.
MySQL CPU usage is 2 min.
I try to find the problem for more than a week, I'll be very, very thankful for your help
Thanks in advance for any reply!