I was using below code in my custom page for establishing sql connection:-
I wrote this code yesterday night and within 12 hours I started getting below error:-
Cannot allocate memory: couldn't create child process:
Can anyone tell me what was wrong in creating connection using above way. Do I need to use persistent sql connection??? I'm new in PHP , so any help will be greatly appreciated
Code:
<?php
$db = mysql_connect("localhost","username","password");
if (!$db) {
die("Database connection failed miserably: " . mysql_error());
}
$db_select = mysql_select_db("databasename",$db);
if (!$db_select) {
die("Database selection also failed miserably: " . mysql_error());
}
$result = mysql_query("SELECT * FROM mytable", $db);
if (!$result) {
die("Database query failed: " . mysql_error());
}
while ($row = mysql_fetch_array($result)) {
echo $row[1]." ".$row[2]."<br />";
}
mysql_close($db);
?>
I wrote this code yesterday night and within 12 hours I started getting below error:-
Cannot allocate memory: couldn't create child process:
Can anyone tell me what was wrong in creating connection using above way. Do I need to use persistent sql connection??? I'm new in PHP , so any help will be greatly appreciated