Note that there are some explanatory texts on larger screens.

plurals
  1. POWarning: gregoriantojd() expects parameter 1 to be long, string given in on line 19
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter-1-to-be-resource-boolean-given-in-select">mysql_fetch_array() expects parameter 1 to be resource, boolean given in select</a> </p> </blockquote> <p>each time i try and pull out a date from row caseOpen in tbl_accident I am greeted by the following error...</p> <blockquote> <p>Warning: gregoriantojd() expects parameter 1 to be long, string given in on line 19</p> </blockquote> <p>what could be the problem? </p> <p>the date in caseOpen has the format dd/mm/YYYY</p> <pre><code>&lt;div style="paddingz: 5px;"&gt; &lt;table width="100%" height="100%" border="0" cellpadding="5" cellspacing="0" class="cp"&gt; &lt;?php // Make a MySQL Connection mysql_select_db("speedycms") or die(mysql_error()); // Get all the data from the "example" table $result = mysql_query("SELECT * FROM tbl_accident ORDER BY id ASC") or die(mysql_error()); // Define $color=1 $color="1"; // date difference function dateDiff($dformat, $endDate, $beginDate) { $date_parts1=explode($dformat, $beginDate); $date_parts2=explode($dformat, $endDate); $start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]); $end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]); return $end_date - $start_date; } $date1 = $row['caseOpen']; $date2 = date('d/m/Y'); echo ' &lt;tr bgcolor="#cccccc"&gt; &lt;td width="45px"&gt;Case ID&lt;/td&gt; &lt;td&gt;Client Name/Address&lt;/td&gt; &lt;td&gt;Accident Date&lt;/td&gt; &lt;td&gt;Case Opened&lt;/td&gt; &lt;td&gt;Days Running&lt;/td&gt;&lt;/tr&gt;'; while($rows=mysql_fetch_array($result)){ // If $color==1 table row color = #FFC600 if($color==1){ echo "&lt;tr bgcolor='#f2f2f2' valign='top'&gt; &lt;td&gt;".$rows['id']."&lt;/td&gt; &lt;td&gt;".$rows['clientName']." &lt;BR&gt; ".$rows['address']."&lt;/td&gt; &lt;td&gt;".$rows['doaDay']."/".$rows['doaMonth']."/".$rows['doaYear']."&lt;/td&gt; &lt;td&gt;".$rows['caseOpen']."&lt;/td&gt; &lt;td&gt;". dateDiff("/", $date2, $date1) ."&lt;/td&gt; &lt;/tr&gt;"; // Set $color==2, for switching to other color $color="2"; } // When $color not equal 1, use this table row color else { echo "&lt;tr bgcolor='#ffffff' valign='top'&gt; &lt;td&gt;".$rows['id']."&lt;/td&gt; &lt;td&gt;".$rows['clientName']." &lt;BR&gt; ".$rows['address']."&lt;/td&gt; &lt;td&gt;".$rows['doaDay']."/".$rows['doaMonth']."/".$rows['doaYear']."&lt;/td&gt; &lt;td&gt;".$rows['caseOpen']."&lt;/td&gt; &lt;/tr&gt;"; // Set $color back to 1 $color="1"; } } echo ''; ?&gt; &lt;/table&gt; &lt;/div&gt; </code></pre> <p>i would appreciate any assistance. thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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