Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Strange error "0:". Possible Object syntax problem?
    text
    copied!<p>I'm trying to transfer a site from one hosting company to another. I was using 000webhost until the client had hosting and a domain. Now that the client has their domain and hosting, using FatCow.com, I can not for the life of me, debug my PHP code. I'm not getting any errors. I have a successful DB connection. If you procedurally display data, it works, but when I try to use my original objects, something is breaking and just returns "0:". I have all errors on. </p> <p><strong>On old server where the site worked:</strong> </p> <p>PHP Version 5.2.11</p> <p>MySQL Version: 5.0.81 </p> <p><strong>On new server where I get the "0:":</strong></p> <p>PHP Version 5.2.12</p> <p>MySQL Version 5.0.32 </p> <p>I've setup a test page to test just the output of the variables with the DB connection. </p> <p>Below is my code:</p> <pre><code>&lt;?php error_reporting(E_ALL); ini_set('display_errors', '1'); try { $link = mysql_connect('connectionstring', 'username', 'password'); if (!$link) { die('Could not connect: ' . mysql_error()); } else{ $db = mysql_select_db('a8210422_lit'); } if($db){ include_once('admin/classes/clsPOW.php'); include_once('admin/classes/clsProviders.php'); $pow = new POW(); $prov = new Providers(); $new = $pow-&gt;getNew(); $newAr = $new-&gt;val(); $get = $prov-&gt;getAll($newAr['providerId']); $getAr = $get-&gt;val(); $img = $getAr['image']; $name = $getAr['provider']; $desc = $getAr['description']; $zip = $getAr['zip']; $web = $getAr['link']; if($zip==0){ $zip = "Unavailable"; } print_r($getAr); } else{ print 'fail!'; } } //catch exception catch(Exception $e) { echo 'Message: ' .$e-&gt;getMessage(); } ?&gt; </code></pre> <p>//Class POW</p> <pre><code>require_once('clsSql.php'); require_once('clsResult.php'); include_once('/hermes/web07/b1323/moo.madisoncountyliterac/assets/includes/db.php'); class POW{ public function getNew(){ //instantiate the sql class $SQL=new sql(); //Run a query - Result is automatically stored in the class $sel = "SELECT providerId FROM litProviders WHERE image != '' ORDER BY RAND() LIMIT 1"; $q=$SQL-&gt;query($sel); return $q; } } </code></pre> <p>//Class Providers</p> <pre><code>require_once('clsSql.php'); require_once('clsResult.php'); include_once('/hermes/web07/b1323/moo.madisoncountyliterac/assets/includes/db.php'); class Providers{ public function getAll($where=""){ if($where == ""){ $getAllQuery = "SELECT * FROM litProviders"; } else{ $getAllQuery = "SELECT * FROM litProviders WHERE providerId = '".$where."'"; } //instantiate the sql class $SQL=new sql(); //Run a query - Result is automatically stored in the class $q=$SQL-&gt;query($getAllQuery); return $q; } public function submit($id="", $provider, $description, $zip, $image, $link){ if($id != ""){ //update $query = "UPDATE litProviders SET provider = '".$provider."', description = '".$description."', zip = '".$zip."', image = '".$image."', link = '".$link."' WHERE providerId = '".$id."' "; $message = "The provider has been updated."; } else{ //insert $newid = md5(uniqid()); $query = "INSERT INTO litProviders VALUES ('".$newid."','".$provider."','".$description."','".$zip."','".$image."', '".$link."')"; $message = "You have added a new provider."; } //instantiate the sql class $SQL=new sql(); //Run a query - Result is automatically stored in the class $q=$SQL-&gt;query($query); return $message; } public function delete($id=""){ if($id !=""){ $delQuery = "DELETE FROM litProviders WHERE providerId = '".$id."'"; //instantiate the sql class $SQL=new sql(); //Run a query - Result is automatically stored in the class $q=$SQL-&gt;query($delQuery); if($q){ return true; } else{ return false; } } else{ return "No ID was provided for deletion."; } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload