Jump to content

[SOLVED] sql problems


tom232

Recommended Posts

Im getting this error: ???
[i]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 ' Resource id #10' at line 1[/i]

what does this mean and how do i fix?

[code]<?php

require_once('db_fns.php');

function register($username, $email, $password)
// register new person with db
// return true or error message
{
  // connect to db
  $conn = mysql_connect(localhost, collegenote, ++++++);
 
  // check if username is unique
$q = "select username from users where username = '$username'";
  $result = mysql_query(" $q, $conn");
IF (!$result)
    THROW NEW EXCEPTION(mysql_error($conn));
if ($result->num_rows>0)
    throw new Exception('That username is taken - go back and choose another one.');

[/code]
Link to comment
https://forums.phpfreaks.com/topic/32708-solved-sql-problems/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.