RE: PHP-MYSQL Question

2009-04-07 Thread abdulazeez alugo

Alright guys,

I just solved the problem. I read from somewhere that if you're using a foreign 
key, it should be the either the primary key in the table or the index so since 
I already used auto increment on table2_id and I've already made it my Primary 
key, I just made table1_id the index and it returned successful. So that was 
the problem all along.

Thanks for your suggestions.

Best regards

Alugo Abdulazeez.
 
> From: defati...@hotmail.com
> To: spa...@googlemail.com
> CC: mysql@lists.mysql.com
> Subject: RE: PHP-MYSQL Question
> Date: Tue, 7 Apr 2009 15:32:25 +0100
> 
> 
> 
> I've done that but it still gives the same error message.
> 
> 
> 
> 
> Date: Tue, 7 Apr 2009 16:25:15 +0200
> Subject: Re: PHP-MYSQL Question
> From: spa...@googlemail.com
> To: defati...@hotmail.com
> CC: mysql@lists.mysql.com
> 
> 
> it is not the ENGINE as Eugene mentioned above, is that you need to use 
> UNSIGNED when creating the second table
> 
> 
> CREATE TABLE table2 ( table2_id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
> table1_id INT UNSIGNED NOT NULL,
> name VARCHAR(100) NOT NULL,
> school VARCHAR(100) NOT NULL,
> comment TEXT NOT NULL,
> entrydate TIMESTAMP NOT NULL,
> FOREIGN KEY(table1_id) REFERENCES table1(table1_id))
> ENGINE = INNODB
> 
> 
> 
> _
> Show them the way! Add maps and directions to your party invites. 
> http://www.microsoft.com/windows/windowslive/products/events.aspx

_
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx

RE: PHP-MYSQL Question

2009-04-07 Thread abdulazeez alugo


 I've done that but it still gives the same error message.

 


Date: Tue, 7 Apr 2009 16:25:15 +0200
Subject: Re: PHP-MYSQL Question
From: spa...@googlemail.com
To: defati...@hotmail.com
CC: mysql@lists.mysql.com


it is not the ENGINE as Eugene mentioned above, is that you need to use 
UNSIGNED when creating the second table


CREATE TABLE table2 ( table2_id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
table1_id INT UNSIGNED NOT NULL,
name VARCHAR(100) NOT NULL,
school VARCHAR(100) NOT NULL,
comment TEXT NOT NULL,
entrydate TIMESTAMP NOT NULL,
FOREIGN KEY(table1_id) REFERENCES table1(table1_id))
ENGINE = INNODB



_
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx

Re: PHP-MYSQL Question

2009-04-07 Thread Spiros Papadopoulos
it is not the ENGINE as Eugene mentioned above, is that you need to use
UNSIGNED when creating the second table

CREATE TABLE table2 ( table2_id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
table1_id INT UNSIGNED NOT NULL,
name VARCHAR(100) NOT NULL,
school VARCHAR(100) NOT NULL,
comment TEXT NOT NULL,
entrydate TIMESTAMP NOT NULL,
FOREIGN KEY(table1_id) REFERENCES table1(table1_id))
ENGINE = INNODB

2009/4/7 abdulazeez alugo 

>
> I've tried it  and i still got the same error. I even dropped table1 and
> recreated it to include the ENGINE=InnoDB and it was successful but table2
> remains unsuccessful.
>
> > Date: Tue, 7 Apr 2009 17:56:49 +0400
> > From: evge...@kosov.su
> > To: defati...@hotmail.com
> > CC: mysql@lists.mysql.com
> > Subject: Re: PHP-MYSQL Question
> >
> > I suppose the problem is that table1.table1_id and table2.table1_id are
> > of different types. The first one is INT UNSIGNED and the second is just
> > INT.
> >
> >
> > abdulazeez alugo wrote:
> > > Table1 is as below:
> > >
> > > CREATE TABLE table1(table1_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
> > > PRIMARY KEY(table1_id),
> > > entrytitle VARCHAR(100) NOT NULL,
> > > entrytext TEXT NOT NULL,
> > > entrydate TIMESTAMP NOT NULL)" );
> > >
> > > I did not put the engine. Could that be the problem?
> > >
> > > > Date: Tue, 7 Apr 2009 17:48:16 +0400
> > > > From: evge...@kosov.su
> > > > To: defati...@hotmail.com
> > > > CC: mysql@lists.mysql.com
> > > > Subject: Re: PHP-MYSQL Question
> > > >
> > > > # perror 150
> > > > MySQL error code 150: Foreign key constraint is incorrectly formed
> > > >
> > > > What does table1 look like?
> > > >
> > > > abdulazeez alugo wrote:
> > > > >
> > > > > Yeah I used the mysql_error and it returned Can't create table
> > > '.\website\table2.frm' (errno: 150). So what does that say?
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >> Date: Tue, 7 Apr 2009 17:38:59 +0400
> > > > >> From: evge...@kosov.su
> > > > >> To: defati...@hotmail.com
> > > > >> CC: mysql@lists.mysql.com
> > > > >> Subject: Re: PHP-MYSQL Question
> > > > >>
> > > > >> Perhaps you don't have permissions to create tables?
> > > > >>
> > > > >> It would have been much clearer if your script was like this:
> > > > >>
> > > > >> $result=mysql_query($your_create_table_statement);
> > > > >> if($result){ print"Successful";}
> > > > >> else {print "Unsuccessful: ".mysql_error()}
> > > > >>
> > > > >>
> > > > >> abdulazeez alugo wrote:
> > > > >>> Hi guys,
> > > > >>>
> > > > >>> Please can anyone tell me what I'm doing wrong with the code
> > > below? It keep
> > > > >>> returning unsuccessful.
> > > > >>>
> > > > >>> $result=mysql_query("CREATE TABLE table2(table2_id INT NOT NULL
> > > PRIMARY KEY
> > > > >>> AUTO_INCREMENT,
> > > > >>> table1_id INT NOT NULL,
> > > > >>> name VARCHAR(100) NOT NULL,
> > > > >>> school VARCHAR(100) NOT NULL,
> > > > >>> comment TEXT NOT NULL,
> > > > >>> entrydate TIMESTAMP NOT NULL,
> > > > >>> FOREIGN KEY(table1_id) REFERENCES table1(table1_id))
> > > > >>> ENGINE = INNODB" );
> > > > >>>
> > > > >>> if($result){ print"Successful";}
> > > > >>> else {print "Unsuccessful";}
> > > > >>>
> > > > >>> Thanks in advance. Cheers.
> > > > >>>
> > > > >>> Alugo Abdulazeez.
> > > > >>>
> > > > >>> _
> > > > >>> More than messages-check out the rest of the Windows Live(tm).
> > > > >>> http://www.microsoft.com/windows/windowslive/
> > > > >>
> > > > >> --
> > > > >> С уважением,
> > > > >> Евгений Косов
> > > > >>
> > > > >> --
> > > > >> MySQL General Mailing List
> > > > >> For list archives: http://lists.mysql.com/mysql
> > > > >> To unsubscribe:
> > > http://lists.mysql.com/mysql?unsub=defati...@hotmail.com
> > > > >>
> > > > >
> > > > > _
> > > > > Invite your mail contacts to join your friends list with Windows
> > > Live Spaces. It's easy!
> > > > >
> > >
> http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
> > > >
> > > >
> > > > --
> > > > С уважением,
> > > > Евгений Косов
> > >
> > >
> 
> > > check out the rest of the Windows Live(tm). More than mail-Windows 
> > > Live(tm)
> > > goes way beyond your inbox. More than messages
> > > <http://www.microsoft.com/windows/windowslive/>
> >
> >
> > --
> > С уважением,
> > Евгений Косов
>
> _
> Show them the way! Add maps and directions to your party invites.
> http://www.microsoft.com/windows/windowslive/products/events.aspx




-- 
Spiros P.


RE: PHP-MYSQL Question

2009-04-07 Thread abdulazeez alugo

I've tried it  and i still got the same error. I even dropped table1 and 
recreated it to include the ENGINE=InnoDB and it was successful but table2 
remains unsuccessful.
 
> Date: Tue, 7 Apr 2009 17:56:49 +0400
> From: evge...@kosov.su
> To: defati...@hotmail.com
> CC: mysql@lists.mysql.com
> Subject: Re: PHP-MYSQL Question
> 
> I suppose the problem is that table1.table1_id and table2.table1_id are 
> of different types. The first one is INT UNSIGNED and the second is just 
> INT.
> 
> 
> abdulazeez alugo wrote:
> > Table1 is as below:
> > 
> > CREATE TABLE table1(table1_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
> > PRIMARY KEY(table1_id),
> > entrytitle VARCHAR(100) NOT NULL,
> > entrytext TEXT NOT NULL,
> > entrydate TIMESTAMP NOT NULL)" );
> > 
> > I did not put the engine. Could that be the problem?
> > 
> > > Date: Tue, 7 Apr 2009 17:48:16 +0400
> > > From: evge...@kosov.su
> > > To: defati...@hotmail.com
> > > CC: mysql@lists.mysql.com
> > > Subject: Re: PHP-MYSQL Question
> > >
> > > # perror 150
> > > MySQL error code 150: Foreign key constraint is incorrectly formed
> > >
> > > What does table1 look like?
> > >
> > > abdulazeez alugo wrote:
> > > >
> > > > Yeah I used the mysql_error and it returned Can't create table 
> > '.\website\table2.frm' (errno: 150). So what does that say?
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >> Date: Tue, 7 Apr 2009 17:38:59 +0400
> > > >> From: evge...@kosov.su
> > > >> To: defati...@hotmail.com
> > > >> CC: mysql@lists.mysql.com
> > > >> Subject: Re: PHP-MYSQL Question
> > > >>
> > > >> Perhaps you don't have permissions to create tables?
> > > >>
> > > >> It would have been much clearer if your script was like this:
> > > >>
> > > >> $result=mysql_query($your_create_table_statement);
> > > >> if($result){ print"Successful";}
> > > >> else {print "Unsuccessful: ".mysql_error()}
> > > >>
> > > >>
> > > >> abdulazeez alugo wrote:
> > > >>> Hi guys,
> > > >>>
> > > >>> Please can anyone tell me what I'm doing wrong with the code 
> > below? It keep
> > > >>> returning unsuccessful.
> > > >>>
> > > >>> $result=mysql_query("CREATE TABLE table2(table2_id INT NOT NULL 
> > PRIMARY KEY
> > > >>> AUTO_INCREMENT,
> > > >>> table1_id INT NOT NULL,
> > > >>> name VARCHAR(100) NOT NULL,
> > > >>> school VARCHAR(100) NOT NULL,
> > > >>> comment TEXT NOT NULL,
> > > >>> entrydate TIMESTAMP NOT NULL,
> > > >>> FOREIGN KEY(table1_id) REFERENCES table1(table1_id))
> > > >>> ENGINE = INNODB" );
> > > >>>
> > > >>> if($result){ print"Successful";}
> > > >>> else {print "Unsuccessful";}
> > > >>>
> > > >>> Thanks in advance. Cheers.
> > > >>>
> > > >>> Alugo Abdulazeez.
> > > >>>
> > > >>> _
> > > >>> More than messages–check out the rest of the Windows Live™.
> > > >>> http://www.microsoft.com/windows/windowslive/
> > > >>
> > > >> --
> > > >> С уважением,
> > > >> Евгений Косов
> > > >>
> > > >> --
> > > >> MySQL General Mailing List
> > > >> For list archives: http://lists.mysql.com/mysql
> > > >> To unsubscribe: 
> > http://lists.mysql.com/mysql?unsub=defati...@hotmail.com
> > > >>
> > > >
> > > > _
> > > > Invite your mail contacts to join your friends list with Windows 
> > Live Spaces. It's easy!
> > > > 
> > http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
> > >
> > >
> > > --
> > > С уважением,
> > > Евгений Косов
> > 
> > 
> > check out the rest of the Windows Live™. More than mail–Windows Live™ 
> > goes way beyond your inbox. More than messages 
> > <http://www.microsoft.com/windows/windowslive/>
> 
> 
> -- 
> С уважением,
> Евгений Косов

_
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx

PHP-MYSQL Question

2009-04-07 Thread abdulazeez alugo

Hi guys,
 
Please can anyone tell me what I'm doing wrong with the code below? It keep 
returning unsuccessful.
 
$result=mysql_query("CREATE TABLE table2(table2_id INT NOT NULL PRIMARY KEY 
AUTO_INCREMENT,
table1_id INT NOT NULL,
name VARCHAR(100) NOT NULL,
school VARCHAR(100) NOT NULL,
comment TEXT NOT NULL,
entrydate TIMESTAMP NOT NULL,
FOREIGN KEY(table1_id) REFERENCES table1(table1_id))
ENGINE = INNODB" );
 
if($result){ print"Successful";}
else {print "Unsuccessful";}
  
Thanks in advance. Cheers.
 
Alugo Abdulazeez.

_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/

Re: PHP-MYSQL Question

2009-04-07 Thread Eugene Kosov
I suppose the problem is that table1.table1_id and table2.table1_id are 
of different types. The first one is INT UNSIGNED and the second is just 
INT.



abdulazeez alugo wrote:

Table1 is as below:
 
CREATE TABLE table1(table1_id INT UNSIGNED NOT NULL AUTO_INCREMENT,

PRIMARY KEY(table1_id),
entrytitle VARCHAR(100) NOT NULL,
entrytext TEXT NOT NULL,
entrydate TIMESTAMP NOT NULL)" );
 
I did not put the engine. Could that be the problem?
 
 > Date: Tue, 7 Apr 2009 17:48:16 +0400

 > From: evge...@kosov.su
 > To: defati...@hotmail.com
 > CC: mysql@lists.mysql.com
 > Subject: Re: PHP-MYSQL Question
 >
 > # perror 150
 > MySQL error code 150: Foreign key constraint is incorrectly formed
 >
 > What does table1 look like?
 >
 > abdulazeez alugo wrote:
 > >
 > > Yeah I used the mysql_error and it returned Can't create table 
'.\website\table2.frm' (errno: 150). So what does that say?

 > >
 > >
 > >
 > >
 > >
 > >
 > >> Date: Tue, 7 Apr 2009 17:38:59 +0400
 > >> From: evge...@kosov.su
 > >> To: defati...@hotmail.com
 > >> CC: mysql@lists.mysql.com
 > >> Subject: Re: PHP-MYSQL Question
 > >>
 > >> Perhaps you don't have permissions to create tables?
 > >>
 > >> It would have been much clearer if your script was like this:
 > >>
 > >> $result=mysql_query($your_create_table_statement);
 > >> if($result){ print"Successful";}
 > >> else {print "Unsuccessful: ".mysql_error()}
 > >>
 > >>
 > >> abdulazeez alugo wrote:
 > >>> Hi guys,
 > >>>
 > >>> Please can anyone tell me what I'm doing wrong with the code 
below? It keep

 > >>> returning unsuccessful.
 > >>>
 > >>> $result=mysql_query("CREATE TABLE table2(table2_id INT NOT NULL 
PRIMARY KEY

 > >>> AUTO_INCREMENT,
 > >>> table1_id INT NOT NULL,
 > >>> name VARCHAR(100) NOT NULL,
 > >>> school VARCHAR(100) NOT NULL,
 > >>> comment TEXT NOT NULL,
 > >>> entrydate TIMESTAMP NOT NULL,
 > >>> FOREIGN KEY(table1_id) REFERENCES table1(table1_id))
 > >>> ENGINE = INNODB" );
 > >>>
 > >>> if($result){ print"Successful";}
 > >>> else {print "Unsuccessful";}
 > >>>
 > >>> Thanks in advance. Cheers.
 > >>>
 > >>> Alugo Abdulazeez.
 > >>>
 > >>> _
 > >>> More than messages–check out the rest of the Windows Live™.
 > >>> http://www.microsoft.com/windows/windowslive/
 > >>
 > >> --
 > >> С уважением,
 > >> Евгений Косов
 > >>
 > >> --
 > >> MySQL General Mailing List
 > >> For list archives: http://lists.mysql.com/mysql
 > >> To unsubscribe: 
http://lists.mysql.com/mysql?unsub=defati...@hotmail.com

 > >>
 > >
 > > _
 > > Invite your mail contacts to join your friends list with Windows 
Live Spaces. It's easy!
 > > 
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us

 >
 >
 > --
 > С уважением,
 > Евгений Косов


check out the rest of the Windows Live™. More than mail–Windows Live™ 
goes way beyond your inbox. More than messages 
<http://www.microsoft.com/windows/windowslive/>



--
С уважением,
Евгений Косов

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



RE: PHP-MYSQL Question

2009-04-07 Thread abdulazeez alugo

Table1 is as below:

 

CREATE TABLE table1(table1_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
PRIMARY KEY(table1_id),
entrytitle VARCHAR(100) NOT NULL,
entrytext TEXT NOT NULL,
entrydate TIMESTAMP NOT NULL)" );

 

I did not put the engine. Could that be the problem?
 
> Date: Tue, 7 Apr 2009 17:48:16 +0400
> From: evge...@kosov.su
> To: defati...@hotmail.com
> CC: mysql@lists.mysql.com
> Subject: Re: PHP-MYSQL Question
> 
> # perror 150
> MySQL error code 150: Foreign key constraint is incorrectly formed
> 
> What does table1 look like?
> 
> abdulazeez alugo wrote:
> > 
> > Yeah I used the mysql_error and it returned Can't create table 
> > '.\website\table2.frm' (errno: 150). So what does that say?
> > 
> > 
> > 
> > 
> > 
> > 
> >> Date: Tue, 7 Apr 2009 17:38:59 +0400
> >> From: evge...@kosov.su
> >> To: defati...@hotmail.com
> >> CC: mysql@lists.mysql.com
> >> Subject: Re: PHP-MYSQL Question
> >>
> >> Perhaps you don't have permissions to create tables?
> >>
> >> It would have been much clearer if your script was like this:
> >>
> >> $result=mysql_query($your_create_table_statement);
> >> if($result){ print"Successful";}
> >> else {print "Unsuccessful: ".mysql_error()}
> >>
> >>
> >> abdulazeez alugo wrote:
> >>> Hi guys,
> >>>
> >>> Please can anyone tell me what I'm doing wrong with the code below? It 
> >>> keep 
> >>> returning unsuccessful.
> >>>
> >>> $result=mysql_query("CREATE TABLE table2(table2_id INT NOT NULL PRIMARY 
> >>> KEY 
> >>> AUTO_INCREMENT,
> >>> table1_id INT NOT NULL,
> >>> name VARCHAR(100) NOT NULL,
> >>> school VARCHAR(100) NOT NULL,
> >>> comment TEXT NOT NULL,
> >>> entrydate TIMESTAMP NOT NULL,
> >>> FOREIGN KEY(table1_id) REFERENCES table1(table1_id))
> >>> ENGINE = INNODB" );
> >>>
> >>> if($result){ print"Successful";}
> >>> else {print "Unsuccessful";}
> >>>
> >>> Thanks in advance. Cheers.
> >>>
> >>> Alugo Abdulazeez.
> >>>
> >>> _
> >>> More than messages–check out the rest of the Windows Live™.
> >>> http://www.microsoft.com/windows/windowslive/
> >>
> >> -- 
> >> С уважением,
> >> Евгений Косов
> >>
> >> -- 
> >> MySQL General Mailing List
> >> For list archives: http://lists.mysql.com/mysql
> >> To unsubscribe: http://lists.mysql.com/mysql?unsub=defati...@hotmail.com
> >>
> > 
> > _
> > Invite your mail contacts to join your friends list with Windows Live 
> > Spaces. It's easy!
> > http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
> 
> 
> -- 
> С уважением,
> Евгений Косов

_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/

Re: PHP-MYSQL Question

2009-04-07 Thread Eugene Kosov

# perror 150
MySQL error code 150: Foreign key constraint is incorrectly formed

What does table1 look like?

abdulazeez alugo wrote:


Yeah I used the mysql_error and it returned Can't create table 
'.\website\table2.frm' (errno: 150). So what does that say?

 

 




Date: Tue, 7 Apr 2009 17:38:59 +0400
From: evge...@kosov.su
To: defati...@hotmail.com
CC: mysql@lists.mysql.com
Subject: Re: PHP-MYSQL Question

Perhaps you don't have permissions to create tables?

It would have been much clearer if your script was like this:

$result=mysql_query($your_create_table_statement);
if($result){ print"Successful";}
else {print "Unsuccessful: ".mysql_error()}


abdulazeez alugo wrote:

Hi guys,

Please can anyone tell me what I'm doing wrong with the code below? It keep 
returning unsuccessful.


$result=mysql_query("CREATE TABLE table2(table2_id INT NOT NULL PRIMARY KEY 
AUTO_INCREMENT,

table1_id INT NOT NULL,
name VARCHAR(100) NOT NULL,
school VARCHAR(100) NOT NULL,
comment TEXT NOT NULL,
entrydate TIMESTAMP NOT NULL,
FOREIGN KEY(table1_id) REFERENCES table1(table1_id))
ENGINE = INNODB" );

if($result){ print"Successful";}
else {print "Unsuccessful";}

Thanks in advance. Cheers.

Alugo Abdulazeez.

_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/


--
С уважением,
Евгений Косов

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=defati...@hotmail.com



_
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us



--
С уважением,
Евгений Косов

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



RE: PHP-MYSQL Question

2009-04-07 Thread abdulazeez alugo


Yeah I used the mysql_error and it returned Can't create table 
'.\website\table2.frm' (errno: 150). So what does that say?

 

 


> Date: Tue, 7 Apr 2009 17:38:59 +0400
> From: evge...@kosov.su
> To: defati...@hotmail.com
> CC: mysql@lists.mysql.com
> Subject: Re: PHP-MYSQL Question
> 
> Perhaps you don't have permissions to create tables?
> 
> It would have been much clearer if your script was like this:
> 
> $result=mysql_query($your_create_table_statement);
> if($result){ print"Successful";}
> else {print "Unsuccessful: ".mysql_error()}
> 
> 
> abdulazeez alugo wrote:
> > Hi guys,
> > 
> > Please can anyone tell me what I'm doing wrong with the code below? It keep 
> > returning unsuccessful.
> > 
> > $result=mysql_query("CREATE TABLE table2(table2_id INT NOT NULL PRIMARY KEY 
> > AUTO_INCREMENT,
> > table1_id INT NOT NULL,
> > name VARCHAR(100) NOT NULL,
> > school VARCHAR(100) NOT NULL,
> > comment TEXT NOT NULL,
> > entrydate TIMESTAMP NOT NULL,
> > FOREIGN KEY(table1_id) REFERENCES table1(table1_id))
> > ENGINE = INNODB" );
> > 
> > if($result){ print"Successful";}
> > else {print "Unsuccessful";}
> > 
> > Thanks in advance. Cheers.
> > 
> > Alugo Abdulazeez.
> > 
> > _
> > More than messages–check out the rest of the Windows Live™.
> > http://www.microsoft.com/windows/windowslive/
> 
> 
> -- 
> С уважением,
> Евгений Косов
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=defati...@hotmail.com
> 

_
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us

Re: PHP-MYSQL Question

2009-04-07 Thread Eugene Kosov

Perhaps you don't have permissions to create tables?

It would have been much clearer if your script was like this:

$result=mysql_query($your_create_table_statement);
if($result){ print"Successful";}
else {print "Unsuccessful: ".mysql_error()}


abdulazeez alugo wrote:

Hi guys,
 
Please can anyone tell me what I'm doing wrong with the code below? It keep 
returning unsuccessful.
 
$result=mysql_query("CREATE TABLE table2(table2_id INT NOT NULL PRIMARY KEY 
AUTO_INCREMENT,

table1_id INT NOT NULL,
name VARCHAR(100) NOT NULL,
school VARCHAR(100) NOT NULL,
comment TEXT NOT NULL,
entrydate TIMESTAMP NOT NULL,
FOREIGN KEY(table1_id) REFERENCES table1(table1_id))
ENGINE = INNODB" );
 
if($result){ print"Successful";}

else {print "Unsuccessful";}
  
Thanks in advance. Cheers.
 
Alugo Abdulazeez.


_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/



--
С уважением,
Евгений Косов

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



Php > mysql question please help

2003-12-25 Thread cohenstudio
I just started working with mysql and I'm very novice
Created a simple database and programmed php to connect as follows...


$link= mysql_connect($hostname,$user,$password)or die ("_something is
whong");
mysql_select_db($db,$link);
$query ="SELECT * FROM projects";
$result = mysql_query($query);
$array = mysql_fetch_array($result);
$usercount = mysql_num_rows($result);
mysql_close($link);
?> 

Question 1 
I put the files created from mysql(MYI ,MYD,frm) in the correct
directory at my site  
Is this correct or do they need some kind of compilling? 

Question 2 
How do I Grant my host name and user name 
I'm comfused..It gives me an error message Can't connect because of host
and user mistake..

Thanks Aaron



Re: PHP / MYSQL Question

2003-02-21 Thread Tore Bostrup
This type of presentation must be produced by code - either your application
(i.e. in your PHP code) or by a report generator.

SQL statements always return data in a tabular format, i.e.

(Topic, Question)
1,1
1,2
1,3
1,4
2,1
2,2
...etc.

In your presentation loop (PHP), remember the "previous" value of Topic from
the previous record, and only output the Topic part when it changes.


HTH,
Tore.


- Original Message -
From: "Mike Walth" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 21, 2003 5:34 AM
Subject: PHP / MYSQL Question


> Not sure if this can be done with just a MYSQL Query or if it needs to be
> done in conjunction with a PHP script.  What I am trying to do is build a
> dynamic FAQ section with PHP.  Here are the two tables
>
> Topics
> ===
> TopicID
> TopicTitle
> TopicDESC
>
> FAQS
> ===
> FAQID
> Question
> Answer
> Topic
>
> I'm trying to get it to display like this
>
> Topic1
>Question1
>Question2
>Question3
>Question4
>
> Topic2
>Question1
>Question2
>
> So each topic would be listed with its set of questions below it.
>
> Any help would be appreciated.
>
> Mike Walth
> CinoFusion
>
>
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




PHP / MYSQL Question

2003-02-21 Thread Mike Walth
Not sure if this can be done with just a MYSQL Query or if it needs to be
done in conjunction with a PHP script.  What I am trying to do is build a
dynamic FAQ section with PHP.  Here are the two tables

Topics
===
TopicID
TopicTitle
TopicDESC

FAQS
===
FAQID
Question
Answer
Topic

I'm trying to get it to display like this

Topic1
   Question1
   Question2
   Question3
   Question4

Topic2
   Question1
   Question2

So each topic would be listed with its set of questions below it.

Any help would be appreciated.

Mike Walth
CinoFusion



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: [PHP] MySQL question...not sure if this is the correct forum to ask.

2002-02-16 Thread DL Neil

Luie,

> Wouldn't replace change all the entries in your table row, same effect as update?
> I believe the question is how to test which entry in a form has a new value and 
>replace/update only that value
in the table.
> If I have a form...
>
>  __
> |Employee Record Update|
> |  |
> |ID No:   1234 |
> |Name:_|
> |Address: _|
> |Status:  Married  |
> |  |
> |Submit|
>  --
>
> If I have this table...
>  _
> |idnonameaddressstatus|
> |-|
> |1234Peter45 street Single|
> |_|
>
> Which means I only want to replace the status and the name and address remains the 
>same.
> How do you test w/c entries in the form have new values and change only those 
>entries in the table?
>
> Peter, this is basically what your asking, right?
> I actually need to figure this one out myself so I would appreciate any info.


Do not use REPLACE if the table uses an AUTO_INCREMENT id, because if you do, any 
other tables linking into the
id column will need to be changed/become dislocated. Even if this is not the case, 
under these circumstances a
REPLACE is two db operations (DELETE followed by INSERT) and should be 'costed' 
accordingly.

In order to populate the form you must have first performed a SELECT to retrieve the 
data from the db. So from
there you can figure out what the data used to be - if you want/need to. You already 
have/send the existing data
values in/to the form (and can have it return form values as normal, and include the 
'original values' in
invisible fields - if you have to go that far).

When the form response comes back you have two choices:

1 PHP: use PHP to compare the ex-db values and the values returned from the form, then 
dynamically construct a
precise UPDATE statement (tailoring the SET clauses to the requisite column name and 
data value pairs). This is
a bit fiddly - and becomes more so as the number of form fields increases.

2 MySQL: use the intelligence of the MySQL UPDATE command (RTFM: MySQL only changes 
those values which need to
be changed) and issue a command which appears to UPDATE every possible-form-affected 
column (regardless of
whether is needs to be updated - according to 'form-thinking', because MySQL will 
decide for you and do the
'database-thinking')

Regards,
=dn


> >What about REPLACE?
> >
> >http://www.mysql.com/doc/R/E/REPLACE.html
> >
> >'REPLACE works exactly like INSERT, except that if an old record in the
> >table has the same value as a new record on a unique index, the old record
> >is deleted before the new record is inserted'
> >
>
> >>
> >> Hi,
> >>
> >> Can the UPDATE statement have conditional check embedded in it?  I
> >> have a page that displays a record (in a FORM format) that the user can
> >> change the information on each column.  I want to check each column and
> >> see which has been changed and update the table for entries that were
> >> changed only.
> >>
> >> for each column data {
> >>   if column is changed
> >>   then update;
> >>   else
> >>   do nothing;
> >> }
> >>
> >> Maybe I am making this too complicated than it needs and just go ahead
> >> and update all of the columns regardless with the new values, regardless
> >> they are actually different or not.
> >>
> >> Thanks in advance,
> >> -Peter



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: [PHP] MySQL question...not sure if this is the correct forum to ask.

2002-02-15 Thread Luie


Wouldn't replace change all the entries in your table row, same effect as update?
I believe the question is how to test which entry in a form has a new value and 
replace/update only that value in the table.
If I have a form...

 __
|Employee Record Update|
|  |  
|ID No:   1234 |  
|Name:_|
|Address: _|
|Status:  Married  | 
|  |  
|Submit|
 --  

If I have this table...
 _
|idnonameaddressstatus|
|-|
|1234Peter45 street Single|
|_|

Which means I only want to replace the status and the name and address remains the 
same.
How do you test w/c entries in the form have new values and change only those entries 
in the table?
  
Peter, this is basically what your asking, right?
I actually need to figure this one out myself so I would appreciate any info.

thanks...

luie


>What about REPLACE?
>
>http://www.mysql.com/doc/R/E/REPLACE.html
>
>'REPLACE works exactly like INSERT, except that if an old record in the
>table has the same value as a new record on a unique index, the old record
>is deleted before the new record is inserted'
>

>>
>> Hi,
>>
>> Can the UPDATE statement have conditional check embedded in it?  I
>> have a page that displays a record (in a FORM format) that the user can
>> change the information on each column.  I want to check each column and
>> see which has been changed and update the table for entries that were
>> changed only.
>>
>> for each column data {
>>   if column is changed
>>   then update;
>>   else
>>   do nothing;
>> }
>>
>> Maybe I am making this too complicated than it needs and just go ahead
>> and update all of the columns regardless with the new values, regardless
>> they are actually different or not.
>>
>> Thanks in advance,
>> -Peter


__
www.edsamail.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: [PHP] MySQL question...not sure if this is the correct forum to ask.

2002-02-14 Thread Daniel Rosher

What about REPLACE?

http://www.mysql.com/doc/R/E/REPLACE.html

'REPLACE works exactly like INSERT, except that if an old record in the
table has the same value as a new record on a unique index, the old record
is deleted before the new record is inserted'

Regards,
Dan

> -Original Message-
> From: Rick Emery [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 15 February 2002 11:10 a.m.
> To: [EMAIL PROTECTED]
> Cc: '[EMAIL PROTECTED]'
> Subject: FW: [PHP] MySQL question...not sure if this is the correct
> forum to ask.
>
>
> -Original Message-
> From: Peter Ruan [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 14, 2002 4:04 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] MySQL question...not sure if this is the correct forum to
> ask.
>
>
> Hi,
>
> Can the UPDATE statement have conditional check embedded in it?  I
> have a page that displays a record (in a FORM format) that the user can
> change the information on each column.  I want to check each column and
> see which has been changed and update the table for entries that were
> changed only.
>
> for each column data {
>   if column is changed
>   then update;
>   else
>   do nothing;
> }
>
> Maybe I am making this too complicated than it needs and just go ahead
> and update all of the columns regardless with the new values, regardless
> they are actually different or not.
>
> Thanks in advance,
> -Peter
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




FW: [PHP] MySQL question...not sure if this is the correct forum to ask.

2002-02-14 Thread Rick Emery

-Original Message-
From: Peter Ruan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 14, 2002 4:04 PM
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL question...not sure if this is the correct forum to
ask.


Hi,

Can the UPDATE statement have conditional check embedded in it?  I
have a page that displays a record (in a FORM format) that the user can
change the information on each column.  I want to check each column and
see which has been changed and update the table for entries that were
changed only.

for each column data {
  if column is changed
  then update;
  else
  do nothing;
}

Maybe I am making this too complicated than it needs and just go ahead
and update all of the columns regardless with the new values, regardless
they are actually different or not.

Thanks in advance,
-Peter




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: PHP/MySQL question - need help with fputs, mysql statements

2001-10-01 Thread Tony Wells

Dave Lake wrote:
> 
> Hi Folks
> 
> I have used MySQL for some time and am just getting my head around PHP. I
> looked across a number of PHP sites for some input on this but failing to
> find an answer thought I would ask some MySQL users (surely many of you are
> using PHP right? ;-) ) for help.
> 
> I recently read a tutorial on mysql/php on webmonkey
> (http://hotwired.lycos.com/webmonkey/99/21/index3a.html for the specific
> page if what I've written below isn't clear)
> 
> After doing the mysql query the results are printed out to the screen/web
> page similar to:
> 
> while ($myrow = mysql_fetch_array($result)) {
>  printf("%s: %s %s - %s\n", $myrow["pos"], $myrow["first"],
> $myrow["last"], $myrow["age"]);
> }
> 
> Where I ran into a problem was when I attempted instead to write to a
> file.
> 
> After opening the file I wanted to print out to I tried several different
> attempts to no avail.
> 
> I tried fputs($theFile, "%s: %s %s - %s\n", $myrow["pos"],
> $myrow["first"], $myrow["last"], $myrow["age"])"
> 

Your PHP looks suspiciously like C... :)  fputs in PHP doesn't do the %
substitutions like printf.

Try modifying the line to look like this and see if this works:  (I'm
assuming you're actually opening the file for a write...)

fputs($theFile, "$myrow[pos]: $myrow[first] $myrow[last] -
$myrow[age]\n"); 

> and other similar but kept getting string error messages.
> 
> I eventually came up with the following solution:
> 
> while ($myrow = mysql_fetch_array($result)) {
> 
>   $mypos = $myrow["pos"]; $myfirst = $myrow["first"];  $mylast =
> $myrow["last"];  $myage =  $myrow["age"];
> 
>   fputs($theFile,
> "$mypos$myfirst$mylast$myage\n");
> 
> }
> 
> This is okay if I am only grabbing four items but from some of my tables
> the query might return 20 columns.
> 
> Wonder if you can explain two things for me?
> 
> The %s in the printf statements above seem to be a placeholder associated
> with the $myrow["pos"] for example. Can you use this in an fputs statement?
> 
> How would I go about printing my mysql query out to a file rather than the
> screen?
> 
> My solution above works but would be rather cumbersome, and I believe there
> should be a more straightforward way but I can't figure it out.
> 
> Thanks in advance.
> 
> Dave Lake
> [EMAIL PROTECTED]
> 
> _
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
> 
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Another PHP/MySQL question

2001-06-10 Thread MikeBlezien

On Sun, 10 Jun 2001 19:13:01 -0700, "Vladimir Kravtsov" <[EMAIL PROTECTED]>
wrote:

>>
>>
>>
>>>connectdb();
>>mysql_select_db(xtopsites);
>>$validated=1;
>>$sql = "select id, siteurl, sitename, from sitesats where validated = "$validated""; 
>//  
^^

Need to correct the double "" quotes at the end of the select statement.
Normally you can use a single quote marks: '$validated'


>>$r = mysql_query($sql);  //You can ignore this line and on since its not relevant to 
>my problem.
>>$numrows = mysql_num_rows($r);
>>echo (mysql_error());
>>$row = mysql_fetch_array($r);
>>?>
>>
>>
>>
>>When I run this I get: Parse error: parse error in

Mike(mickalo)Blezien

Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Tel: 1(225) 686-2002
=
















-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Another PHP/MySQL question

2001-06-10 Thread Whit Blauvelt

On Sun, Jun 10, 2001 at 07:13:01PM -0700, Vladimir Kravtsov wrote:
> $sql = "select id, siteurl, sitename, from sitesats where validated = "$validated""; 
>// Line 8

Actually, using '$validated' might work better - one or the other.

Whit

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Another PHP/MySQL question

2001-06-10 Thread Whit Blauvelt

On Sun, Jun 10, 2001 at 07:13:01PM -0700, Vladimir Kravtsov wrote:
> $sql = "select id, siteurl, sitename, from sitesats where validated = "$validated""; 
>// Line 8

> What's wrong here?

Try \"$validated\" - you need to escape the quoted quotes.

Whit

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Another PHP/MySQL question

2001-06-10 Thread Don Read


On 11-Jun-01 Vladimir Kravtsov wrote:
> 
> 
> 
>  connectdb();
> mysql_select_db(xtopsites);
> $validated=1;
> $sql = "select id, siteurl, sitename, from sitesats where validated =
> "$validated""; // Line 8

  ^  ^ - escape your quotes, \"$validated\"; 
 change to single quotes, '$validated'; or 
 since it's numeric, drop the quoting altogether.


> 
> When I run this I get: Parse error: parse error in
> c:\inetpub\wwwroot/php/X-TopSites/admin/admin.php on line 8
> I want it to select the id, siteurl, sitename (in a table called sitesats)
> of any site which is not validated (I made it so validated=1 and not
> validated=2)
> 
> What's wrong here?

> Thanks alot :)
> 
> 

-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Another PHP/MySQL question

2001-06-10 Thread Augusto Cesar Castoldi

You have a problem with "...

" is reserved word, put \ before it...

try this:

$sql = "select id, siteurl, sitename, from sitesats where validated =
\"$validated\"";

regards,

Augusto

On Sun, 10 Jun 2001, Vladimir Kravtsov wrote:

> 
> 
> 
>  connectdb();
> mysql_select_db(xtopsites);
> $validated=1;
> $sql = "select id, siteurl, sitename, from sitesats where validated = "$validated""; 
>// Line 8
> 
> $r = mysql_query($sql);  //You can ignore this line and on since its not relevant to 
>my problem.
> $numrows = mysql_num_rows($r);
> echo (mysql_error());
> $row = mysql_fetch_array($r);
> ?>
> 
> 
> 
> When I run this I get: Parse error: parse error in 
>c:\inetpub\wwwroot/php/X-TopSites/admin/admin.php on line 8
> I want it to select the id, siteurl, sitename (in a table called sitesats) of any 
>site which is not validated (I made it so validated=1 and not validated=2)
> 
> What's wrong here?
> Thanks alot :)
> 
> 
> 


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Another PHP/MySQL question

2001-06-10 Thread Vladimir Kravtsov








When I run this I get: Parse error: parse error in 
c:\inetpub\wwwroot/php/X-TopSites/admin/admin.php on line 8
I want it to select the id, siteurl, sitename (in a table called sitesats) of any site 
which is not validated (I made it so validated=1 and not validated=2)

What's wrong here?
Thanks alot :)





Re: PHP + MySQL question

2001-06-10 Thread Augusto Cesar Castoldi

you can use fetch_array:

$data = mysql_query("select * from Categories");
$aux="";
while ($row = mysql_fetch_array($data)) {
  $aux.="".$row['Name']."";
}
$aux.="";

echo $aux;

this code will print in html a combobox with the options, in php, the
variable "$catagorie" will have the "id" number of a categorie...

see you,

Augusto

On Sun, 10 Jun 2001, Vladimir Kravtsov wrote:

> Here is my db hierarchy:
> Database: xtopsites
> Table: Categories
> idName
> 1Name1
> 2Name2
> 3Name3
> 4Name4
> 5Name5
> 6Name6
> 
> 
> I would like the user to get to a sign up form and have all the names of the 
>categories displayed.is this possible to do using fetch_array? If it isn't is 
>there another way? (Also could you provide a valid syntax?)
> 
> 
> 
> Thanks alot :)
> 


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: PHP + MySQL question

2001-06-10 Thread j.urban

Have a look at the PHP mysql_fetch_array and mysql_fetch_row functions and
associated documentation...

";
  }
?>

On Sun, 10 Jun 2001, Vladimir Kravtsov wrote:

> Here is my db hierarchy:
> Database: xtopsites
> Table: Categories
> idName
> 1Name1
> 2Name2
> 3Name3
> 4Name4
> 5Name5
> 6Name6
> 
> 
> I would like the user to get to a sign up form and have all the names
> of the categories displayed.is this possible to do using
> fetch_array? If it isn't is there another way? (Also could you provide a
> valid syntax?)



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




PHP + MySQL question

2001-06-10 Thread Vladimir Kravtsov

Here is my db hierarchy:
Database: xtopsites
Table: Categories
idName
1Name1
2Name2
3Name3
4Name4
5Name5
6Name6


I would like the user to get to a sign up form and have all the names of the 
categories displayed.is this possible to do using fetch_array? If it isn't is 
there another way? (Also could you provide a valid syntax?)



Thanks alot :)



Re: php/mysql question

2001-06-09 Thread Olexandr Vynnychenko

Hello Adrian,

Friday, June 08, 2001, 8:59:51 AM, you wrote:

ADC> Hi,

ADC> I am not sure whether this relates to this list or the (not working) php
ADC> list.

ADC> For simplicity:  I have a form that displays data from a table.  I will
ADC> take just one field that displays a name
ADC> 

ADC> This allow a user to update the changes when the submit button is pressed.

ADC> On the next php file I do the following:

ADC> $tname =urldecode($name);
ADC> $tname1 = stripslashes($tname1);
ADC> $updtStmt = "update vusers set orgname='$tname1' where id=$tid";

Why do you use urldecode($name) and stripslashes($tname1)? What for?
Why didn't you try code like this:
$tname = AddSlashes($name);
$updtStmt = "update vusers set orgname='$tname' where id=$tid";

If $name contains "Adrian D'Costa", $updtStmt will contain
"update vusers set orgname='Adrian D\'Costa' where id=$tid"
and the query will be ok. 100% guarantee.

ADC> This works fine, but suppose in by table I have a name "Adrian D'Costa"

ADC> This starts all the problems.  I copy the sql statement from the php file
ADC> and try:

ADC> update vusers set name='Adrian D'Costa' where id=3;
ADC> '>

I get the '>> prompt that is waiting for me the close the '.  If I try the
ADC> same statement in mysql command line:

ADC>  update vusers set name="Adrian D'Costa" where id=3; Query OK, 0 rows
ADC> affected (0.01 sec)
ADC> Rows matched: 1  Changed: 0  Warnings: 0 

ADC> It works.  How do I do the same in php?  

ADC> TIA

ADC> Adrian


ADC> -
ADC> Before posting, please check:
ADC>http://www.mysql.com/manual.php   (the manual)
ADC>http://lists.mysql.com/   (the list archive)

ADC> To request this thread, e-mail <[EMAIL PROTECTED]>
ADC> To unsubscribe, e-mail <[EMAIL PROTECTED]>
ADC> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-- 
Best regards,
 Olexandrmailto:[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Re: php/mysql question (fwd)

2001-06-08 Thread Adrian D'Costa


database,sql,query


On Fri, 8 Jun 2001, Gabriele Bartolini wrote:

> 
> >magic_quotes_gpc   =   On  ; magic quotes for
> >incoming GET/POST/Cookie data
> 
> And, what about: magic_quotes_runtime ?

Off.

Adrian



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: php/mysql question

2001-06-08 Thread Neil Zanella


On Fri, 8 Jun 2001, Rolf Hopkins wrote:

> What you wrote here and what you wrote below are not the same
>
> update vusers set name="Adrian D'Costa" where id=3;
>
> update vusers set name='Adrian D\'Costa' where id=3;
>
> will both work.  Look up the section on escaping special characters in the
> mysql manual.

If you want to safeguard yourself in future PHP scripts use te PHP
htmlentities() command with the special flag to translate quotes.
The outcome of this is effectively what is described above.

Neil


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: php/mysql question

2001-06-08 Thread Rolf Hopkins


- Original Message -
From: "Adrian D'Costa" <[EMAIL PROTECTED]>
To: "Rolf Hopkins" <[EMAIL PROTECTED]>
Cc: "Mysql Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, June 08, 2001 17:47
Subject: Re: php/mysql question


> On Fri, 8 Jun 2001, Rolf Hopkins wrote:
>
> >
> > - Original Message -
> > From: "Adrian D'Costa" <[EMAIL PROTECTED]>
> > To: "Mysql Mailing List" <[EMAIL PROTECTED]>
> > Sent: Friday, June 08, 2001 13:59
> > Subject: php/mysql question
> >
> >
> > > Hi,
> > >
> > > I am not sure whether this relates to this list or the (not working)
php
> > > list.
> > >
> > > For simplicity:  I have a form that displays data from a table.  I
will
> > > take just one field that displays a name
> > > 
> > >
> > > This allow a user to update the changes when the submit button is
pressed.
> > >
> > > On the next php file I do the following:
> > >
> > > $tname =urldecode($name);
> > > $tname1 = stripslashes($tname1);
> > > $updtStmt = "update vusers set orgname='$tname1' where id=$tid";
> > >
> > > This works fine, but suppose in by table I have a name "Adrian
D'Costa"
> > >
> > > This starts all the problems.  I copy the sql statement from the php
file
> > > and try:
> > >
> > > update vusers set name='Adrian D'Costa' where id=3;
> >
> > What you wrote here and what you wrote below are not the same
>
> True.
> >
> > update vusers set name="Adrian D'Costa" where id=3;
>
> This is at the mysql prompt
> >
> > &
> >
> > update vusers set name='Adrian D\'Costa' where id=3;
>
> and this is thru the script.  Both work at the mysql prompt.  But this
> will not work thru the script.  Don't know why.

Both should work through the script.  What's the exact script and what's the
error?

>
> >
> > will both work.  Look up the section on escaping special characters in
the
> > mysql manual.
>
> Mysql Manual, hmmm I remember seeing that when I was with rh6.0 when I
> installed rh7.0 no manual.  Give me a link to download it.
>
www.mysql.com

Don't tell me!  You used RH's mysql RPM to install?!?!  Ouuccc!!!  The
bane of many people's problems.  If you ever find problems with mysql, get
the RPMs from Mysql's website instead.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: php/mysql question

2001-06-08 Thread Adrian D'Costa

On Fri, 8 Jun 2001, Rolf Hopkins wrote:

> 
> - Original Message -
> From: "Adrian D'Costa" <[EMAIL PROTECTED]>
> To: "Mysql Mailing List" <[EMAIL PROTECTED]>
> Sent: Friday, June 08, 2001 13:59
> Subject: php/mysql question
> 
> 
> > Hi,
> >
> > I am not sure whether this relates to this list or the (not working) php
> > list.
> >
> > For simplicity:  I have a form that displays data from a table.  I will
> > take just one field that displays a name
> > 
> >
> > This allow a user to update the changes when the submit button is pressed.
> >
> > On the next php file I do the following:
> >
> > $tname =urldecode($name);
> > $tname1 = stripslashes($tname1);
> > $updtStmt = "update vusers set orgname='$tname1' where id=$tid";
> >
> > This works fine, but suppose in by table I have a name "Adrian D'Costa"
> >
> > This starts all the problems.  I copy the sql statement from the php file
> > and try:
> >
> > update vusers set name='Adrian D'Costa' where id=3;
> 
> What you wrote here and what you wrote below are not the same

True.
> 
> update vusers set name="Adrian D'Costa" where id=3;

This is at the mysql prompt
> 
> &
> 
> update vusers set name='Adrian D\'Costa' where id=3;

and this is thru the script.  Both work at the mysql prompt.  But this
will not work thru the script.  Don't know why.

> 
> will both work.  Look up the section on escaping special characters in the
> mysql manual.

Mysql Manual, hmmm I remember seeing that when I was with rh6.0 when I
installed rh7.0 no manual.  Give me a link to download it.

TIA

Adrian


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: php/mysql question

2001-06-08 Thread Adrian D'Costa

On Fri, 8 Jun 2001, Gabriele Bartolini wrote:

> 
> >$tname =urldecode($name);
> >$tname1 = stripslashes($tname1);
> >$updtStmt = "update vusers set orgname='$tname1' where id=$tid";
> 
> It all depends on these 2 variables settings:
> 
> magic_quotes_gpc=   On
> magic_quotes_runtime=   Off

I grep'ed php.ini, here it is

magic_quotes_gpc=   On  ; magic quotes for
incoming GET/POST/Cookie data

> In this case, the urldecode is in *surplus*. You should remove it, and just 
> use stripslashes.

If I remove urldecode my name returns as 'Adrian+D\'Costa' which mysql
balks at.  If I remove the stripslashes my name is without the slash but
mysql complains that it need another single quote ' to terminate the
command.  

Regards

Adrian


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: php/mysql question

2001-06-08 Thread Pascal MiQUET

Did you try the following code

$updtStmt = "update vusers set orgname=\"$tname1\" where id=$tid";

Should do the job.
Regards
P. Miquet

- Original Message -
From: "Adrian D'Costa" <[EMAIL PROTECTED]>
To: "Mysql Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, June 08, 2001 7:59 AM
Subject: php/mysql question


> Hi,
>
> I am not sure whether this relates to this list or the (not working) php
> list.
>
> For simplicity:  I have a form that displays data from a table.  I will
> take just one field that displays a name
> 
>
> This allow a user to update the changes when the submit button is pressed.
>
> On the next php file I do the following:
>
> $tname =urldecode($name);
> $tname1 = stripslashes($tname1);
> $updtStmt = "update vusers set orgname='$tname1' where id=$tid";
>
> This works fine, but suppose in by table I have a name "Adrian D'Costa"
>
> This starts all the problems.  I copy the sql statement from the php file
> and try:
>
> update vusers set name='Adrian D'Costa' where id=3;
> '>
>
> I get the '> prompt that is waiting for me the close the '.  If I try the
> same statement in mysql command line:
>
>  update vusers set name="Adrian D'Costa" where id=3; Query OK, 0 rows
> affected (0.01 sec)
> Rows matched: 1  Changed: 0  Warnings: 0
>
> It works.  How do I do the same in php?
>
> TIA
>
> Adrian
>
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




php/mysql question

2001-06-08 Thread Adrian D'Costa

Hi,

I am not sure whether this relates to this list or the (not working) php
list.

For simplicity:  I have a form that displays data from a table.  I will
take just one field that displays a name


This allow a user to update the changes when the submit button is pressed.

On the next php file I do the following:

$tname =urldecode($name);
$tname1 = stripslashes($tname1);
$updtStmt = "update vusers set orgname='$tname1' where id=$tid";

This works fine, but suppose in by table I have a name "Adrian D'Costa"

This starts all the problems.  I copy the sql statement from the php file
and try:

update vusers set name='Adrian D'Costa' where id=3;
'>

I get the '> prompt that is waiting for me the close the '.  If I try the
same statement in mysql command line:

 update vusers set name="Adrian D'Costa" where id=3; Query OK, 0 rows
affected (0.01 sec)
Rows matched: 1  Changed: 0  Warnings: 0 

It works.  How do I do the same in php?  

TIA

Adrian


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: php/mysql question

2001-06-08 Thread Rolf Hopkins


- Original Message -
From: "Adrian D'Costa" <[EMAIL PROTECTED]>
To: "Mysql Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, June 08, 2001 13:59
Subject: php/mysql question


> Hi,
>
> I am not sure whether this relates to this list or the (not working) php
> list.
>
> For simplicity:  I have a form that displays data from a table.  I will
> take just one field that displays a name
> 
>
> This allow a user to update the changes when the submit button is pressed.
>
> On the next php file I do the following:
>
> $tname =urldecode($name);
> $tname1 = stripslashes($tname1);
> $updtStmt = "update vusers set orgname='$tname1' where id=$tid";
>
> This works fine, but suppose in by table I have a name "Adrian D'Costa"
>
> This starts all the problems.  I copy the sql statement from the php file
> and try:
>
> update vusers set name='Adrian D'Costa' where id=3;

What you wrote here and what you wrote below are not the same

update vusers set name="Adrian D'Costa" where id=3;

&

update vusers set name='Adrian D\'Costa' where id=3;

will both work.  Look up the section on escaping special characters in the
mysql manual.



> '>
>
> I get the '> prompt that is waiting for me the close the '.  If I try the
> same statement in mysql command line:
>
>  update vusers set name="Adrian D'Costa" where id=3; Query OK, 0 rows
> affected (0.01 sec)
> Rows matched: 1  Changed: 0  Warnings: 0
>
> It works.  How do I do the same in php?
>
> TIA
>
> Adrian
>
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php