Note that there are some explanatory texts on larger screens.

plurals
  1. POphp function call messes up table
    primarykey
    data
    text
    <p>I've got a html table I build from the database:</p> <pre><code>&lt;tr onclick="DoNav('&lt;?php echo $result_videos[$i]["video_url"]; ?&gt;');"&gt; &lt;td&gt; &lt;?php echo $result_videos[$i]["camera_name"]; ?&gt; &lt;/td&gt; &lt;td&gt; Timezone: &lt;?php echo queryTimezone(); ?&gt; &lt;br&gt; Video Size: &lt;?php echo $result_videos[$i]["video_size"]; ?&gt; bytes &lt;br&gt; Video Length: &lt;?php echo strTime($result_videos[$i]["video_length"]); ?&gt; &lt;/td&gt; &lt;td&gt; &lt;form name="myform" action="&lt;?php echo htmlentities($_SERVER['REQUEST_URI']); ?&gt;" method="POST"&gt; &lt;input type="submit" name="delete_video" value="Delete" title="Delete this video" onClick="return confirm('Are you sure you want to delete?')"/&gt; &lt;input type="hidden" name="video_url" value="&lt;?php echo $result_videos[$i]["video_url"]; ?&gt;" /&gt; &lt;/form&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>The problem is this function:</p> <pre><code>function queryTimezone() { $query = "SELECT timezone FROM #__camcloud_users WHERE user_id=".$user-&gt;id; $db-&gt;setQuery($query); $timezone = $db-&gt;loadResult(); return $timezone; } </code></pre> <p>It messes the table up. I don't seem to get any php errors and it cuts off the table at the "Timezone:" part and throws it to the top right of the page. Basically where I call the function <code>queryTimezone</code>. If I change to put this inside the html table it works fine:</p> <pre><code>&lt;tr onclick="DoNav('&lt;?php echo $result_videos[$i]["video_url"]; ?&gt;');"&gt; &lt;td&gt; &lt;?php echo $result_videos[$i]["camera_name"]; ?&gt; &lt;/td&gt; &lt;td&gt; Timezone: &lt;?php $query = "SELECT timezone FROM #__camcloud_users WHERE user_id=".$user-&gt;id; $db-&gt;setQuery($query); $timezone = $db-&gt;loadResult(); echo $timezone; ?&gt; &lt;br&gt; Video Size: &lt;?php echo $result_videos[$i]["video_size"]; ?&gt; bytes &lt;br&gt; Video Length: &lt;?php echo strTime($result_videos[$i]["video_length"]); ?&gt; &lt;/td&gt; &lt;td&gt; &lt;form name="myform" action="&lt;?php echo htmlentities($_SERVER['REQUEST_URI']); ?&gt;" method="POST"&gt; &lt;input type="submit" name="delete_video" value="Delete" title="Delete this video" onClick="return confirm('Are you sure you want to delete?')"/&gt; &lt;input type="hidden" name="video_url" value="&lt;?php echo $result_videos[$i]["video_url"]; ?&gt;" /&gt; &lt;/form&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>This works fine. Did I do something wrong with how I call the function?</p>
    singulars
    1. This table or related slice is empty.
    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.
    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