Welcome Guest, Not a member yet? Register   Sign In
how to type syntax correctly ?
#1

[eluser]yudahebat[/eluser]
I have a function that contain syntax like this
Code:
$query = $this->db->query('select * from reservasi where tgl_pesan between '2009-04-21'and '2009-04-25'');
       foreach ($query->result() as $row)...

bacause it shows error
Code:
Parse error: syntax error, unexpected T_LNUMBER in C:\xampp\htdocs\CI2\system\application\views\cetak_data.php on line 19
#2

[eluser]Thorpe Obazee[/eluser]
[quote author="yudahebat" date="1244117061"]I have a function that contain syntax like this
Code:
$query = $this->db->query('select * from reservasi where tgl_pesan between '2009-04-21'and '2009-04-25'');
       foreach ($query->result() as $row)...

bacause it shows error
Code:
Parse error: syntax error, unexpected T_LNUMBER in C:\xampp\htdocs\CI2\system\application\views\cetak_data.php on line 19
[/quote]
Code:
$query = $this->db->query("select * from reservasi where tgl_pesan between '" . 2009-04-21 ."' and '" . 2009-04-25 . "'");
#3

[eluser]yudahebat[/eluser]
Code:
[code]yudahebat - 04 June 2009 02:04 AM

    I have a function that contain syntax like this
    $query = $this->db->query('select * from reservasi where tgl_pesan between '2009-04-21'and '2009-04-25'');
           foreach ($query->result() as $row)...

bacause it shows error
Code:
Parse error: syntax error, unexpected T_LNUMBER in C:\xampp\htdocs\CI2\system\application\views\cetak_data.php on line 19

Code:
$query = $this->db->query("select * from reservasi where tgl_pesan between "'" . 2009-04-21' and '" . 2009-04-25 . "'"); [/code]

I' fix my code like your code, but it shown error
Code:
Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\CI2\system\application\views\cetak_data.php on line 19

whats wrong??
#4

[eluser]Thorpe Obazee[/eluser]
[quote author="yudahebat" date="1244118049"]
Code:
[code]yudahebat - 04 June 2009 02:04 AM

    I have a function that contain syntax like this
    $query = $this->db->query('select * from reservasi where tgl_pesan between '2009-04-21'and '2009-04-25'');
           foreach ($query->result() as $row)...

bacause it shows error
Code:
Parse error: syntax error, unexpected T_LNUMBER in C:\xampp\htdocs\CI2\system\application\views\cetak_data.php on line 19

Code:
$query = $this->db->query("select * from reservasi where tgl_pesan between "'" . 2009-04-21' and '" . 2009-04-25 . "'"); [/code]

I' fix my code like your code, but it shown error
Code:
Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\CI2\system\application\views\cetak_data.php on line 19

whats wrong??[/quote]

Ermm.... take a look at my code again. You aren't escaping strings properly.
#5

[eluser]yudahebat[/eluser]
upss sorry.. it works, bu its shown erorr like this
Code:
A Database Error Occurred

Error Number: 1064

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
'-54'' at line 1

-54'
#6

[eluser]Thorpe Obazee[/eluser]
Check your other sql statements.
#7

[eluser]yudahebat[/eluser]
yepp, thx...




Theme © iAndrew 2016 - Forum software by © MyBB