Note that there are some explanatory texts on larger screens.

plurals
  1. POMember function Row
    primarykey
    data
    text
    <p>I tried running the query in my script and receiving this message. Anyone know why AND how to fix it.</p> <p>Fatal error: Call to a member function row() on a non-object</p> <pre><code>$query_str = "SELECT MAX(userID) FROM kowmanager_users"; $this-&gt;db-&gt;query($query_str); $row = $query-&gt;row(); $userID = $row-&gt;userID; </code></pre> <p>Edit:</p> <p>I found the syntax for this here: <a href="http://codeigniter.com/user_guide/database/active_record.html#select" rel="nofollow">http://codeigniter.com/user_guide/database/active_record.html#select</a></p> <p>And came up with this for my needs but when I ran the script it gave me a You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Object' at line 1</p> <p>Filename: /home/xtremer/public_html/kowmanager/models/user_model.php</p> <pre><code>$this-&gt;db-&gt;select_max('userID'); $query_str = $this-&gt;db-&gt;get('kowmanager_users'); $rows = $this-&gt;db-&gt;query($query_str); $userID = $rows-&gt;userID; $userID = $userID + 1; </code></pre> <p>Edit 2:</p> <p>For some reason the update isn't running.</p> <pre><code> $query_str = "INSERT INTO kowmanager_users (username, password, password2, email, firstName, lastName, accessLevelID) VALUES (?, ?, ?, ?, ?, ?, ?)"; $this-&gt;db-&gt;query($query_str, array($username, $password[0], $password[1], $email, $firstName, $lastName, '1',)); $id = $this-&gt;db-&gt;insert_id(); $this-&gt;db-&gt;select_max('userID'); $query = $this-&gt;db-&gt;get('kowmanager_users'); $row = $query-&gt;row(); $userID = $row-&gt;userID; echo $userID; echo "&lt;br&gt;"; $userID = $userID + 1; echo $userID; $data = array('userID' =&gt; $userID); $where = "id = '".$id."'"; $str = $this-&gt;db-&gt;update_string('kowmanager_users', $data, $where); </code></pre> <p>Edit: Here's my full page code: <a href="http://pastebin.com/7sJt7V09" rel="nofollow">http://pastebin.com/7sJt7V09</a></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.
    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