Re: [PHP-DB] Please help a newbie

2009-04-19 Thread mrfroasty

Hello,

May be try something like this:

$query1=
CREATE TABLE contacts(
id int(16) NOT NULL auto_increment,
phone varchar(15)  NOT NULL,
name varchar(15) NOT NULL,
address varchar(15) NOT NULL,
PRIMARY KEY (id)
);

$query2 = INSERT INTO contacts VALUES ('NULL','$phone', '$name', 
'$address');


P:S
id incremented automatically by MYSQL now

GR
mrfroasty



Rij wrote:

Hello,

I am new to the world of PHP and MySQL. My objective is to create a
table, insert values in it and read it back.

Here's the partial code to create a table from a PHP file:

if (!$table_exists) {
$query=CREATE TABLE contacts (id int(20) NOT NULL, name
varchar(15) NOT NULL, address varchar(15),PRIMARY KEY(id)
if (mysql_query($query, $con)) echo Table contacts created;
else die('Unable to create table : '.mysql_error());
}


I input the values from a HTML form. Here is the partial code.
$phone = $_POST['phone'];
$name  = $_POST['name'];
$address = $_POST['address'];
$query = INSERT INTO contacts VALUES ('$phone', '$name', '$address');
if (mysql_query($query, $con)) echo Values inserted;
else die('Unable to create table : '.mysql_error());


Now the problem that I am facing is that when I make my first insert,
the id field shows a garbage value and not the number that I entered.
Subsequent entries into the table show up just fine. It's only the
first one.

What am I doing wrong?

Thanks, Rij

  



--
Extra details:
OSS:Gentoo Linux-2.6.25-r8
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash,PHP,SQL,HTML,CSS
Typo:40WPM
url:http://mambo-tech.net
url:http://blog.mambo-tech.net


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



Re: [PHP-DB] Please help a newbie

2009-04-19 Thread Daniel Carrera

Rij wrote:

I input the values from a HTML form. Here is the partial code.
$phone = $_POST['phone'];
$name  = $_POST['name'];
$address = $_POST['address'];
$query = INSERT INTO contacts VALUES ('$phone', '$name', '$address');
if (mysql_query($query, $con)) echo Values inserted;
else die('Unable to create table : '.mysql_error());


This is unsafe code. I suggest you lookup prepared statements and the 
PDO library (which is part of PHP).


Daniel.

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



Re: [PHP-DB] Please help a newbie: Fixed

2009-04-19 Thread Rij
Ok, figured it out.
I was using an int for the field but the value was too large for it. I
used bigint instead and life is suddenly so much better. Well it helps
that its bright and sunny here too :)

On Sun, Apr 19, 2009 at 10:37 AM, mrfroasty mrfroa...@gmail.com wrote:
 Try using var_export() or var_dump() to debug to see why that 1st time is
 having different values than what you want :-)
 The idea from the sample code I have provided is not to use phone as id...

 P:S
 A wild guess would phone is some sort of string.

 GR
 mrfroasty



 Rij wrote:

 Ok. But that still doesn't tell me why I am getting the behavior from
 my code. Where is the garbage value coming from? And why only the
 first time I do an INSERT?

 To Daniel Carrera, thanks for your tip. I sure will look up your
 suggestion.

 On Sun, Apr 19, 2009 at 2:32 AM, mrfroasty mrfroa...@gmail.com wrote:


 Hello,

 May be try something like this:

 $query1=
 CREATE TABLE contacts(
 id int(16) NOT NULL auto_increment,
 phone varchar(15)  NOT NULL,
 name varchar(15) NOT NULL,
 address varchar(15) NOT NULL,
 PRIMARY KEY (id)
 );

 $query2 = INSERT INTO contacts VALUES ('NULL','$phone', '$name',
 '$address');

 P:S
 id incremented automatically by MYSQL now

 GR
 mrfroasty








 --
 Extra details:
 OSS:Gentoo Linux-2.6.25-r8
 profile:x86
 Hardware:msi geforce 8600GT asus p5k-se
 location:/home/muhsin
 language(s):C/C++,VB,VHDL,bash,PHP,SQL,HTML,CSS
 Typo:40WPM
 url:http://mambo-tech.net
 url:http://blog.mambo-tech.net



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



Re: [PHP-DB] Please help a newbie

2009-04-19 Thread Chris

mrfroasty wrote:

Hello,

May be try something like this:

$query1=
CREATE TABLE contacts(
id int(16) NOT NULL auto_increment,
phone varchar(15)  NOT NULL,
name varchar(15) NOT NULL,
address varchar(15) NOT NULL,
PRIMARY KEY (id)
);

$query2 = INSERT INTO contacts VALUES ('NULL','$phone', '$name', 
'$address');


P:S
id incremented automatically by MYSQL now


Maybe - but it's by accident. You're trying to insert the word NULL into 
an int field (it's being treated as a word because of the single quotes 
around it).


Don't specify the id field at all:

$query2 = insert into contacts(phone, name, address) values (' . 
mysql_real_escape_string($_POST['phone']) . ', ' . 
mysql_real_escape_string($_POST['name']) . ', ' . 
mysql_real_escape_string($_POST['address']) . ');


You should always use the field names (as above) because if your table 
gets reordered, your inserts will now break - if you put name before 
phone, the data is now going into the wrong fields.


--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP-DB] Please help

2004-09-14 Thread Micah Stevens



WHERE columname LIKE condition

^^^ example.





On Friday 10 September 2004 10:22 am, Stuart Felenstein wrote:
 Okay, I was under the impression that where is
 implied inthe joins xx.xx = xx.xx .  Is that not the
 case ?
 As a matter of fact, there isn't even a where or like
 in my query.  Then again myabe that's why I can see
 *all* records but not run a search.

 Can you please provide an exmample of the column name
 bteween where and like ?

 Thank you.
 Stuart

 --- Micah Stevens [EMAIL PROTECTED] wrote:
  If you look at the query, there's no column name
  between 'WHERE' and 'LIKE'
  which is a syntax error. That's the problem.
 
 
  Looks like your sql generator has some issues, or
  you didn't specify the WHERE
  column properly. I'm not familiar with the system
  you're using, but keep in
  mind, that mysql_error will usually not steer you
  wrong.
 
  -Micah
 
  On Friday 10 September 2004 10:03 am, Stuart
 
  Felenstein wrote:
   I had not, my apologies.  I think your post
 
  slipped
 
   by.  Anyway, yes I have now inserted mysql_error()
 
  and
 
   got my return.  Though I'm not entirely sure how
 
  to
 
   fix it.
   Here is the error.
  
   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 'Like 'ACCFIN'' at line 1
   SELECT `VendorJobs`.`JobID`,
   `VendorSignUp`.`CompanyName`,
   `StaIndTypes`.`CareerCategories`,
   `StaUSCities`.`City`, `USStates`.`States`,
   `VendorJobs`.`AreaCode`, `staTaxTerm`.`TaxTerm`,
   `VendorJobs`.`PayRate`,
 
  `staTravelReq`.`TravelReq`,
 
   `VendorJobDetails`.`Details`,
   `VendorJobs`.`PostStart`, `VendorJobs`.`JobTitle`
 
  FROM
 
   `VendorJobs` INNER JOIN `VendorSignUp` ON
   (`VendorJobs`.`VendorID` =
 
  `VendorSignUp`.`VendorID`)
 
   INNER JOIN `StaIndTypes` ON
 
  (`VendorJobs`.`Industry` =
 
   `StaIndTypes`.`CareerIDs`) LEFT OUTER JOIN
   `StaUSCities` ON (`VendorJobs`.`LocationCity` =
   `StaUSCities`.`CityID`) LEFT OUTER JOIN `USStates`
 
  ON
 
   (`VendorJobs`.`LocationState` =
 
  `USStates`.`StateID`)
 
   LEFT OUTER JOIN `staTaxTerm` ON
   (`VendorJobs`.`TaxTerm` =
 
  `staTaxTerm`.`TaxTermID`)
 
   INNER JOIN `staTravelReq` ON
 
  (`VendorJobs`.`TravelReq`
 
   = `staTravelReq`.`TravelReqID`) INNER JOIN
   `VendorJobDetails` ON (`VendorJobs`.`JobID` =
   `VendorJobDetails`.`JobID`) where Like 'ACCFIN'
 
  limit
 
   0,1
  
   --
  
   --- Micah Stevens [EMAIL PROTECTED]
 
  wrote:
did you make the change to the code I suggested?
What does MySQL say the error
is?
   
-Micah
   
   
On Friday 10 September 2004 07:49 am, Stuart
   
Felenstein wrote:
 As I said this is a code generator
 
  (dbqwiksite).
 
So,
   
 describing the process for creating the code
 
  is
 
 different.  The $sql is fine, as far as typos
 
  or
 
 incorrect characterrs.  I've gone through
 
  those
 
 statement very carefully.
 I've also tried to run a debug with no luck.
 But I do know that there is something wrong
 
  with
 
the
   
 statement, since I can get a complete display
 
  of
 
all
   
 records, but can't search using criteria.

 Below is the $sql, one I know works , though
 
  I've
 
 tried others.  VendorJobs is the table I'm
   
querying ,
   
 and since it's made up of values from other
 
  static
 
 type tables I have all the joins in place.

 I've also taken the tick marks out, thinking
 
  maybe
 
it
   
 was a style issue.  I'm not sure where to go
 
  with
 
it.
   
 Getting a response from the company is like
 
  pretty
 
 difficult.

   `VendorJobs`.`JobID`,
   `VendorSignUp`.`CompanyName`,
   `StaIndTypes`.`CareerCategories`,
   `StaUSCities`.`City`,
   `USStates`.`States`,
   `VendorJobs`.`AreaCode`,
   `staTaxTerm`.`TaxTerm`,
   `VendorJobs`.`PayRate`,
   `staTravelReq`.`TravelReq`,
   `VendorJobDetails`.`Details`,
   `VendorJobs`.`PostStart`,
   `VendorJobs`.`JobTitle`
 FROM
   `VendorJobs`
   INNER JOIN `VendorSignUp` ON
 (`VendorJobs`.`VendorID` =
   
`VendorSignUp`.`VendorID`)
   
   INNER JOIN `StaIndTypes` ON
   
(`VendorJobs`.`Industry`
   
 = `StaIndTypes`.`CareerIDs`)
   LEFT OUTER JOIN `StaUSCities` ON
 (`VendorJobs`.`LocationCity` =
   
`StaUSCities`.`CityID`)
   
   LEFT OUTER JOIN `USStates` ON
 (`VendorJobs`.`LocationState` =
   
`USStates`.`StateID`)
   
   LEFT OUTER JOIN `staTaxTerm` ON
 (`VendorJobs`.`TaxTerm` =
   
`staTaxTerm`.`TaxTermID`)
   
   INNER JOIN `staTravelReq` ON
 (`VendorJobs`.`TravelReq` =
 `staTravelReq`.`TravelReqID`)
   INNER JOIN `VendorJobDetails` ON
 (`VendorJobs`.`JobID` =
   
`VendorJobDetails`.`JobID`)
   
 Stuart

 --- Philip Thompson [EMAIL PROTECTED] wrote:
  I 

Re: [PHP-DB] Please help

2004-09-10 Thread Philip Thompson
I think everyone knows that $sql is a statement. But what people are 
asking is: what is that statement?! Because if there are incorrect 
characters or 's in that statement, then that can break your 
code/statement.

~Philip
On Sep 9, 2004, at 5:49 PM, Stuart Felenstein wrote:
Just getting back to this thing.  There are 3 files
involved, search.php, connections.php and
functions.php.
I searched through all and couldn't find the meaning
of the $sql_ext.   $sql is just the sql statement I
inserted into the code.
Great that I can't get a response from the company.
If anyone thinks it would be useful to post the code I
will. That is if anyone would want to see and look at
it.
The weird thing is searching on one table is great.
The list (all records) works great.  The problem
starts when I insert all my joins.  Now I've tested
and retested the query and I know it's fine.
Thank you ,
Stuart
--- Steve Davies [EMAIL PROTECTED] wrote:
What's contained in $sql and $sql_ext ???
Stuart Felenstein wrote:
I'm using a product called dbqwiksite pro.  PHP
generator for PHP - MySQL
The code seems to be working fine except in my
search
page where I receive an invalid query
$result = mysql_query($sql .   . $sql_ext . 
limit
0,1)
or die(Invalid query);
This is the place I where the code is taking the
die
path.
I'm guessing something belongs between the
quotation
marks , just not sure.
Anyone ?
Thank you
Stuart

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

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


Re: [PHP-DB] Please help

2004-09-10 Thread Stuart Felenstein
As I said this is a code generator (dbqwiksite). So,
describing the process for creating the code is
different.  The $sql is fine, as far as typos or
incorrect characterrs.  I've gone through those
statement very carefully.
I've also tried to run a debug with no luck.
But I do know that there is something wrong with the
statement, since I can get a complete display of all
records, but can't search using criteria.

Below is the $sql, one I know works , though I've
tried others.  VendorJobs is the table I'm querying ,
and since it's made up of values from other static
type tables I have all the joins in place. 

I've also taken the tick marks out, thinking maybe it
was a style issue.  I'm not sure where to go with it. 
Getting a response from the company is like pretty
difficult.
 
  `VendorJobs`.`JobID`,
  `VendorSignUp`.`CompanyName`,
  `StaIndTypes`.`CareerCategories`,
  `StaUSCities`.`City`,
  `USStates`.`States`,
  `VendorJobs`.`AreaCode`,
  `staTaxTerm`.`TaxTerm`,
  `VendorJobs`.`PayRate`,
  `staTravelReq`.`TravelReq`,
  `VendorJobDetails`.`Details`,
  `VendorJobs`.`PostStart`,
  `VendorJobs`.`JobTitle`
FROM
  `VendorJobs`
  INNER JOIN `VendorSignUp` ON
(`VendorJobs`.`VendorID` = `VendorSignUp`.`VendorID`)
  INNER JOIN `StaIndTypes` ON (`VendorJobs`.`Industry`
= `StaIndTypes`.`CareerIDs`)
  LEFT OUTER JOIN `StaUSCities` ON
(`VendorJobs`.`LocationCity` = `StaUSCities`.`CityID`)
  LEFT OUTER JOIN `USStates` ON
(`VendorJobs`.`LocationState` = `USStates`.`StateID`)
  LEFT OUTER JOIN `staTaxTerm` ON
(`VendorJobs`.`TaxTerm` = `staTaxTerm`.`TaxTermID`)
  INNER JOIN `staTravelReq` ON
(`VendorJobs`.`TravelReq` =
`staTravelReq`.`TravelReqID`)
  INNER JOIN `VendorJobDetails` ON
(`VendorJobs`.`JobID` = `VendorJobDetails`.`JobID`)

Stuart
--- Philip Thompson [EMAIL PROTECTED] wrote:

 I think everyone knows that $sql is a statement. But
 what people are 
 asking is: what is that statement?! Because if there
 are incorrect 
 characters or 's in that statement, then that can
 break your 
 code/statement.
 
 ~Philip
 
 On Sep 9, 2004, at 5:49 PM, Stuart Felenstein wrote:
 
  Just getting back to this thing.  There are 3
 files
  involved, search.php, connections.php and
  functions.php.
 
  I searched through all and couldn't find the
 meaning
  of the $sql_ext.   $sql is just the sql statement
 I
  inserted into the code.
 
  Great that I can't get a response from the
 company.
  If anyone thinks it would be useful to post the
 code I
  will. That is if anyone would want to see and look
 at
  it.
 
  The weird thing is searching on one table is
 great.
  The list (all records) works great.  The problem
  starts when I insert all my joins.  Now I've
 tested
  and retested the query and I know it's fine.
 
  Thank you ,
  Stuart
 
 
  --- Steve Davies [EMAIL PROTECTED] wrote:
 
  What's contained in $sql and $sql_ext ???
 
 
  Stuart Felenstein wrote:
 
  I'm using a product called dbqwiksite pro.  PHP
  generator for PHP - MySQL
 
  The code seems to be working fine except in my
  search
  page where I receive an invalid query
 
  $result = mysql_query($sql .   . $sql_ext . 
  limit
  0,1)
  or die(Invalid query);
 
  This is the place I where the code is taking the
  die
  path.
  I'm guessing something belongs between the
  quotation
  marks , just not sure.
 
  Anyone ?
 
  Thank you
  Stuart
 
 
 
 
  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit:
 http://www.php.net/unsub.php
 
 
 
  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit:
 http://www.php.net/unsub.php
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP-DB] Please help

2004-09-10 Thread Micah Stevens
did you make the change to the code I suggested? What does MySQL say the error 
is? 

-Micah 


On Friday 10 September 2004 07:49 am, Stuart Felenstein wrote:
 As I said this is a code generator (dbqwiksite). So,
 describing the process for creating the code is
 different.  The $sql is fine, as far as typos or
 incorrect characterrs.  I've gone through those
 statement very carefully.
 I've also tried to run a debug with no luck.
 But I do know that there is something wrong with the
 statement, since I can get a complete display of all
 records, but can't search using criteria.

 Below is the $sql, one I know works , though I've
 tried others.  VendorJobs is the table I'm querying ,
 and since it's made up of values from other static
 type tables I have all the joins in place.

 I've also taken the tick marks out, thinking maybe it
 was a style issue.  I'm not sure where to go with it.
 Getting a response from the company is like pretty
 difficult.

   `VendorJobs`.`JobID`,
   `VendorSignUp`.`CompanyName`,
   `StaIndTypes`.`CareerCategories`,
   `StaUSCities`.`City`,
   `USStates`.`States`,
   `VendorJobs`.`AreaCode`,
   `staTaxTerm`.`TaxTerm`,
   `VendorJobs`.`PayRate`,
   `staTravelReq`.`TravelReq`,
   `VendorJobDetails`.`Details`,
   `VendorJobs`.`PostStart`,
   `VendorJobs`.`JobTitle`
 FROM
   `VendorJobs`
   INNER JOIN `VendorSignUp` ON
 (`VendorJobs`.`VendorID` = `VendorSignUp`.`VendorID`)
   INNER JOIN `StaIndTypes` ON (`VendorJobs`.`Industry`
 = `StaIndTypes`.`CareerIDs`)
   LEFT OUTER JOIN `StaUSCities` ON
 (`VendorJobs`.`LocationCity` = `StaUSCities`.`CityID`)
   LEFT OUTER JOIN `USStates` ON
 (`VendorJobs`.`LocationState` = `USStates`.`StateID`)
   LEFT OUTER JOIN `staTaxTerm` ON
 (`VendorJobs`.`TaxTerm` = `staTaxTerm`.`TaxTermID`)
   INNER JOIN `staTravelReq` ON
 (`VendorJobs`.`TravelReq` =
 `staTravelReq`.`TravelReqID`)
   INNER JOIN `VendorJobDetails` ON
 (`VendorJobs`.`JobID` = `VendorJobDetails`.`JobID`)

 Stuart

 --- Philip Thompson [EMAIL PROTECTED] wrote:
  I think everyone knows that $sql is a statement. But
  what people are
  asking is: what is that statement?! Because if there
  are incorrect
  characters or 's in that statement, then that can
  break your
  code/statement.
 
  ~Philip
 
  On Sep 9, 2004, at 5:49 PM, Stuart Felenstein wrote:
   Just getting back to this thing.  There are 3
 
  files
 
   involved, search.php, connections.php and
   functions.php.
  
   I searched through all and couldn't find the
 
  meaning
 
   of the $sql_ext.   $sql is just the sql statement
 
  I
 
   inserted into the code.
  
   Great that I can't get a response from the
 
  company.
 
   If anyone thinks it would be useful to post the
 
  code I
 
   will. That is if anyone would want to see and look
 
  at
 
   it.
  
   The weird thing is searching on one table is
 
  great.
 
   The list (all records) works great.  The problem
   starts when I insert all my joins.  Now I've
 
  tested
 
   and retested the query and I know it's fine.
  
   Thank you ,
   Stuart
  
   --- Steve Davies [EMAIL PROTECTED] wrote:
   What's contained in $sql and $sql_ext ???
  
   Stuart Felenstein wrote:
   I'm using a product called dbqwiksite pro.  PHP
   generator for PHP - MySQL
  
   The code seems to be working fine except in my
  
   search
  
   page where I receive an invalid query
  
   $result = mysql_query($sql .   . $sql_ext . 
  
   limit
  
   0,1)
   or die(Invalid query);
  
   This is the place I where the code is taking the
  
   die
  
   path.
   I'm guessing something belongs between the
  
   quotation
  
   marks , just not sure.
  
   Anyone ?
  
   Thank you
   Stuart
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit:
 
  http://www.php.net/unsub.php
 
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit:
 
  http://www.php.net/unsub.php
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

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



Re: [PHP-DB] Please help

2004-09-10 Thread Stuart Felenstein
I had not, my apologies.  I think your post slipped
by.  Anyway, yes I have now inserted mysql_error() and
got my return.  Though I'm not entirely sure how to
fix it.
Here is the error.

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 'Like 'ACCFIN'' at line 1
SELECT `VendorJobs`.`JobID`,
`VendorSignUp`.`CompanyName`,
`StaIndTypes`.`CareerCategories`,
`StaUSCities`.`City`, `USStates`.`States`,
`VendorJobs`.`AreaCode`, `staTaxTerm`.`TaxTerm`,
`VendorJobs`.`PayRate`, `staTravelReq`.`TravelReq`,
`VendorJobDetails`.`Details`,
`VendorJobs`.`PostStart`, `VendorJobs`.`JobTitle` FROM
`VendorJobs` INNER JOIN `VendorSignUp` ON
(`VendorJobs`.`VendorID` = `VendorSignUp`.`VendorID`)
INNER JOIN `StaIndTypes` ON (`VendorJobs`.`Industry` =
`StaIndTypes`.`CareerIDs`) LEFT OUTER JOIN
`StaUSCities` ON (`VendorJobs`.`LocationCity` =
`StaUSCities`.`CityID`) LEFT OUTER JOIN `USStates` ON
(`VendorJobs`.`LocationState` = `USStates`.`StateID`)
LEFT OUTER JOIN `staTaxTerm` ON
(`VendorJobs`.`TaxTerm` = `staTaxTerm`.`TaxTermID`)
INNER JOIN `staTravelReq` ON (`VendorJobs`.`TravelReq`
= `staTravelReq`.`TravelReqID`) INNER JOIN
`VendorJobDetails` ON (`VendorJobs`.`JobID` =
`VendorJobDetails`.`JobID`) where Like 'ACCFIN' limit
0,1

--
--- Micah Stevens [EMAIL PROTECTED] wrote:

 did you make the change to the code I suggested?
 What does MySQL say the error 
 is? 
 
 -Micah 
 
 
 On Friday 10 September 2004 07:49 am, Stuart
 Felenstein wrote:
  As I said this is a code generator (dbqwiksite).
 So,
  describing the process for creating the code is
  different.  The $sql is fine, as far as typos or
  incorrect characterrs.  I've gone through those
  statement very carefully.
  I've also tried to run a debug with no luck.
  But I do know that there is something wrong with
 the
  statement, since I can get a complete display of
 all
  records, but can't search using criteria.
 
  Below is the $sql, one I know works , though I've
  tried others.  VendorJobs is the table I'm
 querying ,
  and since it's made up of values from other static
  type tables I have all the joins in place.
 
  I've also taken the tick marks out, thinking maybe
 it
  was a style issue.  I'm not sure where to go with
 it.
  Getting a response from the company is like pretty
  difficult.
 
`VendorJobs`.`JobID`,
`VendorSignUp`.`CompanyName`,
`StaIndTypes`.`CareerCategories`,
`StaUSCities`.`City`,
`USStates`.`States`,
`VendorJobs`.`AreaCode`,
`staTaxTerm`.`TaxTerm`,
`VendorJobs`.`PayRate`,
`staTravelReq`.`TravelReq`,
`VendorJobDetails`.`Details`,
`VendorJobs`.`PostStart`,
`VendorJobs`.`JobTitle`
  FROM
`VendorJobs`
INNER JOIN `VendorSignUp` ON
  (`VendorJobs`.`VendorID` =
 `VendorSignUp`.`VendorID`)
INNER JOIN `StaIndTypes` ON
 (`VendorJobs`.`Industry`
  = `StaIndTypes`.`CareerIDs`)
LEFT OUTER JOIN `StaUSCities` ON
  (`VendorJobs`.`LocationCity` =
 `StaUSCities`.`CityID`)
LEFT OUTER JOIN `USStates` ON
  (`VendorJobs`.`LocationState` =
 `USStates`.`StateID`)
LEFT OUTER JOIN `staTaxTerm` ON
  (`VendorJobs`.`TaxTerm` =
 `staTaxTerm`.`TaxTermID`)
INNER JOIN `staTravelReq` ON
  (`VendorJobs`.`TravelReq` =
  `staTravelReq`.`TravelReqID`)
INNER JOIN `VendorJobDetails` ON
  (`VendorJobs`.`JobID` =
 `VendorJobDetails`.`JobID`)
 
  Stuart
 
  --- Philip Thompson [EMAIL PROTECTED] wrote:
   I think everyone knows that $sql is a statement.
 But
   what people are
   asking is: what is that statement?! Because if
 there
   are incorrect
   characters or 's in that statement, then that
 can
   break your
   code/statement.
  
   ~Philip
  
   On Sep 9, 2004, at 5:49 PM, Stuart Felenstein
 wrote:
Just getting back to this thing.  There are 3
  
   files
  
involved, search.php, connections.php and
functions.php.
   
I searched through all and couldn't find the
  
   meaning
  
of the $sql_ext.   $sql is just the sql
 statement
  
   I
  
inserted into the code.
   
Great that I can't get a response from the
  
   company.
  
If anyone thinks it would be useful to post
 the
  
   code I
  
will. That is if anyone would want to see and
 look
  
   at
  
it.
   
The weird thing is searching on one table is
  
   great.
  
The list (all records) works great.  The
 problem
starts when I insert all my joins.  Now I've
  
   tested
  
and retested the query and I know it's fine.
   
Thank you ,
Stuart
   
--- Steve Davies [EMAIL PROTECTED]
 wrote:
What's contained in $sql and $sql_ext ???
   
Stuart Felenstein wrote:
I'm using a product called dbqwiksite pro. 
 PHP
generator for PHP - MySQL
   
The code seems to be working fine except in
 my
   
search
   
page where I receive an invalid query
   
$result = mysql_query($sql .   . $sql_ext
 . 
   
limit
   
0,1)
or 

Re: [PHP-DB] Please help

2004-09-10 Thread Stuart Felenstein
Okay, I was under the impression that where is
implied inthe joins xx.xx = xx.xx .  Is that not the
case ?
As a matter of fact, there isn't even a where or like
in my query.  Then again myabe that's why I can see
*all* records but not run a search.  

Can you please provide an exmample of the column name
bteween where and like ?

Thank you.
Stuart


--- Micah Stevens [EMAIL PROTECTED] wrote:

 
 If you look at the query, there's no column name
 between 'WHERE' and 'LIKE' 
 which is a syntax error. That's the problem.
 
 
 Looks like your sql generator has some issues, or
 you didn't specify the WHERE 
 column properly. I'm not familiar with the system
 you're using, but keep in 
 mind, that mysql_error will usually not steer you
 wrong. 
 
 -Micah 
 
 On Friday 10 September 2004 10:03 am, Stuart
 Felenstein wrote:
  I had not, my apologies.  I think your post
 slipped
  by.  Anyway, yes I have now inserted mysql_error()
 and
  got my return.  Though I'm not entirely sure how
 to
  fix it.
  Here is the error.
 
  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 'Like 'ACCFIN'' at line 1
  SELECT `VendorJobs`.`JobID`,
  `VendorSignUp`.`CompanyName`,
  `StaIndTypes`.`CareerCategories`,
  `StaUSCities`.`City`, `USStates`.`States`,
  `VendorJobs`.`AreaCode`, `staTaxTerm`.`TaxTerm`,
  `VendorJobs`.`PayRate`,
 `staTravelReq`.`TravelReq`,
  `VendorJobDetails`.`Details`,
  `VendorJobs`.`PostStart`, `VendorJobs`.`JobTitle`
 FROM
  `VendorJobs` INNER JOIN `VendorSignUp` ON
  (`VendorJobs`.`VendorID` =
 `VendorSignUp`.`VendorID`)
  INNER JOIN `StaIndTypes` ON
 (`VendorJobs`.`Industry` =
  `StaIndTypes`.`CareerIDs`) LEFT OUTER JOIN
  `StaUSCities` ON (`VendorJobs`.`LocationCity` =
  `StaUSCities`.`CityID`) LEFT OUTER JOIN `USStates`
 ON
  (`VendorJobs`.`LocationState` =
 `USStates`.`StateID`)
  LEFT OUTER JOIN `staTaxTerm` ON
  (`VendorJobs`.`TaxTerm` =
 `staTaxTerm`.`TaxTermID`)
  INNER JOIN `staTravelReq` ON
 (`VendorJobs`.`TravelReq`
  = `staTravelReq`.`TravelReqID`) INNER JOIN
  `VendorJobDetails` ON (`VendorJobs`.`JobID` =
  `VendorJobDetails`.`JobID`) where Like 'ACCFIN'
 limit
  0,1
 
  --
 
  --- Micah Stevens [EMAIL PROTECTED]
 wrote:
   did you make the change to the code I suggested?
   What does MySQL say the error
   is?
  
   -Micah
  
  
   On Friday 10 September 2004 07:49 am, Stuart
  
   Felenstein wrote:
As I said this is a code generator
 (dbqwiksite).
  
   So,
  
describing the process for creating the code
 is
different.  The $sql is fine, as far as typos
 or
incorrect characterrs.  I've gone through
 those
statement very carefully.
I've also tried to run a debug with no luck.
But I do know that there is something wrong
 with
  
   the
  
statement, since I can get a complete display
 of
  
   all
  
records, but can't search using criteria.
   
Below is the $sql, one I know works , though
 I've
tried others.  VendorJobs is the table I'm
  
   querying ,
  
and since it's made up of values from other
 static
type tables I have all the joins in place.
   
I've also taken the tick marks out, thinking
 maybe
  
   it
  
was a style issue.  I'm not sure where to go
 with
  
   it.
  
Getting a response from the company is like
 pretty
difficult.
   
  `VendorJobs`.`JobID`,
  `VendorSignUp`.`CompanyName`,
  `StaIndTypes`.`CareerCategories`,
  `StaUSCities`.`City`,
  `USStates`.`States`,
  `VendorJobs`.`AreaCode`,
  `staTaxTerm`.`TaxTerm`,
  `VendorJobs`.`PayRate`,
  `staTravelReq`.`TravelReq`,
  `VendorJobDetails`.`Details`,
  `VendorJobs`.`PostStart`,
  `VendorJobs`.`JobTitle`
FROM
  `VendorJobs`
  INNER JOIN `VendorSignUp` ON
(`VendorJobs`.`VendorID` =
  
   `VendorSignUp`.`VendorID`)
  
  INNER JOIN `StaIndTypes` ON
  
   (`VendorJobs`.`Industry`
  
= `StaIndTypes`.`CareerIDs`)
  LEFT OUTER JOIN `StaUSCities` ON
(`VendorJobs`.`LocationCity` =
  
   `StaUSCities`.`CityID`)
  
  LEFT OUTER JOIN `USStates` ON
(`VendorJobs`.`LocationState` =
  
   `USStates`.`StateID`)
  
  LEFT OUTER JOIN `staTaxTerm` ON
(`VendorJobs`.`TaxTerm` =
  
   `staTaxTerm`.`TaxTermID`)
  
  INNER JOIN `staTravelReq` ON
(`VendorJobs`.`TravelReq` =
`staTravelReq`.`TravelReqID`)
  INNER JOIN `VendorJobDetails` ON
(`VendorJobs`.`JobID` =
  
   `VendorJobDetails`.`JobID`)
  
Stuart
   
--- Philip Thompson [EMAIL PROTECTED] wrote:
 I think everyone knows that $sql is a
 statement.
  
   But
  
 what people are
 asking is: what is that statement?! Because
 if
  
   there
  
 are incorrect
 characters or 's in that statement, then
 that
  
   can
  
 break your
 code/statement.

 ~Philip

 On Sep 9, 2004, at 5:49 PM, Stuart
 Felenstein
  
 
=== message truncated 

Fwd: Re: [PHP-DB] Please help

2004-09-10 Thread Micah Stevens
Forgot to CC the list.. 
---BeginMessage---

there is a WHERE on the last line of the statement you sent me.

Where's are in the form of:

WHERE value condition value

Yours is in the form:
WHERE condition value

You're not providing anything to compare the latter value to. You can imply 
conditions in the join syntax for sure, but the fact of the matter remains 
you are in addition specifying a syntactically incorrect WHERE statement at 
the end. 

-Micah 

On Friday 10 September 2004 10:22 am, you wrote:
 Okay, I was under the impression that where is
 implied inthe joins xx.xx = xx.xx .  Is that not the
 case ?
 As a matter of fact, there isn't even a where or like
 in my query.  Then again myabe that's why I can see
 *all* records but not run a search.

 Can you please provide an exmample of the column name
 bteween where and like ?

 Thank you.
 Stuart

 --- Micah Stevens [EMAIL PROTECTED] wrote:
  If you look at the query, there's no column name
  between 'WHERE' and 'LIKE'
  which is a syntax error. That's the problem.
 
 
  Looks like your sql generator has some issues, or
  you didn't specify the WHERE
  column properly. I'm not familiar with the system
  you're using, but keep in
  mind, that mysql_error will usually not steer you
  wrong.
 
  -Micah
 
  On Friday 10 September 2004 10:03 am, Stuart
 
  Felenstein wrote:
   I had not, my apologies.  I think your post
 
  slipped
 
   by.  Anyway, yes I have now inserted mysql_error()
 
  and
 
   got my return.  Though I'm not entirely sure how
 
  to
 
   fix it.
   Here is the error.
  
   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 'Like 'ACCFIN'' at line 1
   SELECT `VendorJobs`.`JobID`,
   `VendorSignUp`.`CompanyName`,
   `StaIndTypes`.`CareerCategories`,
   `StaUSCities`.`City`, `USStates`.`States`,
   `VendorJobs`.`AreaCode`, `staTaxTerm`.`TaxTerm`,
   `VendorJobs`.`PayRate`,
 
  `staTravelReq`.`TravelReq`,
 
   `VendorJobDetails`.`Details`,
   `VendorJobs`.`PostStart`, `VendorJobs`.`JobTitle`
 
  FROM
 
   `VendorJobs` INNER JOIN `VendorSignUp` ON
   (`VendorJobs`.`VendorID` =
 
  `VendorSignUp`.`VendorID`)
 
   INNER JOIN `StaIndTypes` ON
 
  (`VendorJobs`.`Industry` =
 
   `StaIndTypes`.`CareerIDs`) LEFT OUTER JOIN
   `StaUSCities` ON (`VendorJobs`.`LocationCity` =
   `StaUSCities`.`CityID`) LEFT OUTER JOIN `USStates`
 
  ON
 
   (`VendorJobs`.`LocationState` =
 
  `USStates`.`StateID`)
 
   LEFT OUTER JOIN `staTaxTerm` ON
   (`VendorJobs`.`TaxTerm` =
 
  `staTaxTerm`.`TaxTermID`)
 
   INNER JOIN `staTravelReq` ON
 
  (`VendorJobs`.`TravelReq`
 
   = `staTravelReq`.`TravelReqID`) INNER JOIN
   `VendorJobDetails` ON (`VendorJobs`.`JobID` =
   `VendorJobDetails`.`JobID`) where Like 'ACCFIN'
 
  limit
 
   0,1
  
   --
  
   --- Micah Stevens [EMAIL PROTECTED]
 
  wrote:
did you make the change to the code I suggested?
What does MySQL say the error
is?
   
-Micah
   
   
On Friday 10 September 2004 07:49 am, Stuart
   
Felenstein wrote:
 As I said this is a code generator
 
  (dbqwiksite).
 
So,
   
 describing the process for creating the code
 
  is
 
 different.  The $sql is fine, as far as typos
 
  or
 
 incorrect characterrs.  I've gone through
 
  those
 
 statement very carefully.
 I've also tried to run a debug with no luck.
 But I do know that there is something wrong
 
  with
 
the
   
 statement, since I can get a complete display
 
  of
 
all
   
 records, but can't search using criteria.

 Below is the $sql, one I know works , though
 
  I've
 
 tried others.  VendorJobs is the table I'm
   
querying ,
   
 and since it's made up of values from other
 
  static
 
 type tables I have all the joins in place.

 I've also taken the tick marks out, thinking
 
  maybe
 
it
   
 was a style issue.  I'm not sure where to go
 
  with
 
it.
   
 Getting a response from the company is like
 
  pretty
 
 difficult.

   `VendorJobs`.`JobID`,
   `VendorSignUp`.`CompanyName`,
   `StaIndTypes`.`CareerCategories`,
   `StaUSCities`.`City`,
   `USStates`.`States`,
   `VendorJobs`.`AreaCode`,
   `staTaxTerm`.`TaxTerm`,
   `VendorJobs`.`PayRate`,
   `staTravelReq`.`TravelReq`,
   `VendorJobDetails`.`Details`,
   `VendorJobs`.`PostStart`,
   `VendorJobs`.`JobTitle`
 FROM
   `VendorJobs`
   INNER JOIN `VendorSignUp` ON
 (`VendorJobs`.`VendorID` =
   
`VendorSignUp`.`VendorID`)
   
   INNER JOIN `StaIndTypes` ON
   
(`VendorJobs`.`Industry`
   
 = `StaIndTypes`.`CareerIDs`)
   LEFT OUTER JOIN `StaUSCities` ON
 (`VendorJobs`.`LocationCity` =
   
`StaUSCities`.`CityID`)
   
   LEFT OUTER JOIN `USStates` ON
 (`VendorJobs`.`LocationState` =
   
`USStates`.`StateID`)
   
   

Re: [PHP-DB] Please help

2004-09-10 Thread Stuart Felenstein
I think maybe there is an implied where in the
generated code, but not in my statement.  I'm saying
when I chose ACCFIN (as in the referred error
message), the join should be looking at the referred
table , value ACCFIN .  e.g. Code_Table.CodeID
(ACCFIN) = MAIN_Table.CodeID (ACCFIN) return label.

Here is the code, and I honestly am not trying to
argue , just understand. Apologies if I'm belabouring
the point.

?php
require('LFW3_connection.php');
require('qs_functions.php');
@session_start();
$err_string = ;
$strkeyword = ;
$sql = ;
$sql_ext = ;
$fields = array();
$fields[0] = JobID;
$fields[1] = CompanyName;
$fields[2] = CareerCategories;
$fields[3] = City;
$fields[4] = States;
$fields[5] = AreaCode;
$fields[6] = TaxTerm;
$fields[7] = PayRate;
$fields[8] = TravelReq;
$fields[9] = Details;
$fields[10] = PostStart;
$fields[11] = JobTitle;
$arryitemvalue = array();
$arryitemvalue[0] = ;
$arryitemvalue[1] = ;
$arryitemvalue[2] = ;
$arryitemvalue[3] = ;
$arryitemvalue[4] = ;
$arryitemvalue[5] = ;
$arryitemvalue[6] = ;
$arryitemvalue[7] = ;
$arryitemvalue[8] = ;
$arryitemvalue[9] = ;
$arryitemvalue[10] = ;
$arryitemvalue[11] = ;
$arryopt = array();
$arryopt[0] = ;
$arryopt[1] = ;
$arryopt[2] = ;
$arryopt[3] = ;
$arryopt[4] = ;
$arryopt[5] = ;
$arryopt[6] = ;
$arryopt[7] = ;
$arryopt[8] = ;
$arryopt[9] = ;
$arryopt[10] = ;
$arryopt[11] = ;
$sql .=  SELECT ;
$sql .=VendorJobs.JobID,;
$sql .=VendorSignUp.CompanyName,;
$sql .=StaIndTypes.CareerCategories,;
$sql .=StaUSCities.City,;
$sql .=USStates.States,;
$sql .=VendorJobs.AreaCode,;
$sql .=staTaxTerm.TaxTerm,;
$sql .=VendorJobs.PayRate,;
$sql .=staTravelReq.TravelReq,;
$sql .=VendorJobDetails.Details,;
$sql .=VendorJobs.PostStart,;
$sql .=VendorJobs.JobTitle;
$sql .=  FROM;
$sql .=VendorJobs;
$sql .=INNER JOIN VendorSignUp ON
(VendorJobs.VendorID = VendorSignUp.VendorID);
$sql .=INNER JOIN StaIndTypes ON
(VendorJobs.Industry = StaIndTypes.CareerIDs);
$sql .=LEFT OUTER JOIN StaUSCities ON
(VendorJobs.LocationCity = StaUSCities.CityID);
$sql .=LEFT OUTER JOIN USStates ON
(VendorJobs.LocationState = USStates.StateID);
$sql .=LEFT OUTER JOIN staTaxTerm ON
(VendorJobs.TaxTerm = staTaxTerm.TaxTermID);
$sql .=INNER JOIN staTravelReq ON
(VendorJobs.TravelReq = staTravelReq.TravelReqID);
$sql .=INNER JOIN VendorJobDetails ON
(VendorJobs.JobID = VendorJobDetails.JobID);


$result = mysql_query($sql .   . $sql_ext .  limit
0,1)  or
die(mysql_error().br.$sql. .$sql_ext .  limit
0,1br);
if (isset($_POST[QS_Submit])) {
$filter_string = ;
$qry_string = ;
$i = 0;
while ($i  mysql_num_fields($result)) {
$meta = mysql_fetch_field($result);
$field_name = $meta-name;
$field_type = $meta-type;
if ((qsrequest(search_fd . $i) != ) 
(qsrequest(search_fd . $i) != *)) {
$idata = qsrequest(search_fd . $i);
if (strlen($idata)  1) {
if ($idata[strlen($idata) - 1] == *)
{
$idata = substr($idata, 0,
strlen($idata) - 1);
}
}
$idata = str_replace(*, %, $idata);
$irealdata = $idata;
if (qsrequest(search_optfd.$i) != ) {
  $idata = qsrequest(search_optfd. $i) .
$idata ;
}
$iopt = substr($idata, 0, 2);
if (($iopt == =) || ($iopt == =)) {
$iopt = =;
$irealdata = substr($idata, 2);
} elseif (($iopt == =) || ($iopt ==
=)) {
$iopt = =;
$irealdata = substr($idata, 2);
} elseif ($iopt == ==) {
$iopt = =;
$irealdata = substr($idata, 2);
} elseif ($iopt == ) {
$irealdata = substr($idata, 2);
} elseif ($iopt == ^^) {
  $iopt = *;
$idata =  $iopt . $irealdata . $iopt; //
Contain
  } elseif ($iopt == ^*) {
  $iopt = *;
$idata =  $irealdata . $iopt; // Start
With
  } elseif ($iopt == *^) {
  $iopt = *;
$idata =  $iopt . $irealdata ; // End
With
} else {
$iopt = substr($idata, 0, 1);
if (($iopt == ) || ($iopt == )
|| ($iopt == =)) {
$irealdata = substr($idata,1);
} else {
$iopt = =;
}
}
if (!strcasecmp($idata,{current date and
time})) {
$idata = time();
} elseif (!strcasecmp($idata,{current
date})) {
$idata = time();
} elseif (!strcasecmp($idata,{current
time})) {
$idata = time();
}
if ($meta) {
if ((strtolower($field_type) ==
timestamp)
  ||(strtolower($field_type) ==
datetime)
  ||(strtolower($field_type) ==
smalldatetime)
  ||(strtolower($field_type) 

Re: [PHP-DB] Please help

2004-09-10 Thread Micah Stevens

I understand your intent, but that is not really what is happening. The code 
changes I suggested did two things: 

1) Echo's the error statement that mysql produces

2) Echo's the actual SQL statement that is sent to the DB

you should be looking at #2 for answers, not your intended query. This 
'actual' query is what I'm referring to. 

-Micah 

On Friday 10 September 2004 10:46 am, Stuart Felenstein wrote:
 I think maybe there is an implied where in the
 generated code, but not in my statement.  I'm saying
 when I chose ACCFIN (as in the referred error
 message), the join should be looking at the referred
 table , value ACCFIN .  e.g. Code_Table.CodeID
 (ACCFIN) = MAIN_Table.CodeID (ACCFIN) return label.

 Here is the code, and I honestly am not trying to
 argue , just understand. Apologies if I'm belabouring
 the point.

 ?php
 require('LFW3_connection.php');
 require('qs_functions.php');
 @session_start();
 $err_string = ;
 $strkeyword = ;
 $sql = ;
 $sql_ext = ;
 $fields = array();
 $fields[0] = JobID;
 $fields[1] = CompanyName;
 $fields[2] = CareerCategories;
 $fields[3] = City;
 $fields[4] = States;
 $fields[5] = AreaCode;
 $fields[6] = TaxTerm;
 $fields[7] = PayRate;
 $fields[8] = TravelReq;
 $fields[9] = Details;
 $fields[10] = PostStart;
 $fields[11] = JobTitle;
 $arryitemvalue = array();
 $arryitemvalue[0] = ;
 $arryitemvalue[1] = ;
 $arryitemvalue[2] = ;
 $arryitemvalue[3] = ;
 $arryitemvalue[4] = ;
 $arryitemvalue[5] = ;
 $arryitemvalue[6] = ;
 $arryitemvalue[7] = ;
 $arryitemvalue[8] = ;
 $arryitemvalue[9] = ;
 $arryitemvalue[10] = ;
 $arryitemvalue[11] = ;
 $arryopt = array();
 $arryopt[0] = ;
 $arryopt[1] = ;
 $arryopt[2] = ;
 $arryopt[3] = ;
 $arryopt[4] = ;
 $arryopt[5] = ;
 $arryopt[6] = ;
 $arryopt[7] = ;
 $arryopt[8] = ;
 $arryopt[9] = ;
 $arryopt[10] = ;
 $arryopt[11] = ;
 $sql .=  SELECT ;
 $sql .=VendorJobs.JobID,;
 $sql .=VendorSignUp.CompanyName,;
 $sql .=StaIndTypes.CareerCategories,;
 $sql .=StaUSCities.City,;
 $sql .=USStates.States,;
 $sql .=VendorJobs.AreaCode,;
 $sql .=staTaxTerm.TaxTerm,;
 $sql .=VendorJobs.PayRate,;
 $sql .=staTravelReq.TravelReq,;
 $sql .=VendorJobDetails.Details,;
 $sql .=VendorJobs.PostStart,;
 $sql .=VendorJobs.JobTitle;
 $sql .=  FROM;
 $sql .=VendorJobs;
 $sql .=INNER JOIN VendorSignUp ON
 (VendorJobs.VendorID = VendorSignUp.VendorID);
 $sql .=INNER JOIN StaIndTypes ON
 (VendorJobs.Industry = StaIndTypes.CareerIDs);
 $sql .=LEFT OUTER JOIN StaUSCities ON
 (VendorJobs.LocationCity = StaUSCities.CityID);
 $sql .=LEFT OUTER JOIN USStates ON
 (VendorJobs.LocationState = USStates.StateID);
 $sql .=LEFT OUTER JOIN staTaxTerm ON
 (VendorJobs.TaxTerm = staTaxTerm.TaxTermID);
 $sql .=INNER JOIN staTravelReq ON
 (VendorJobs.TravelReq = staTravelReq.TravelReqID);
 $sql .=INNER JOIN VendorJobDetails ON
 (VendorJobs.JobID = VendorJobDetails.JobID);


 $result = mysql_query($sql .   . $sql_ext .  limit
 0,1)  or
 die(mysql_error().br.$sql. .$sql_ext .  limit
 0,1br);
 if (isset($_POST[QS_Submit])) {
 $filter_string = ;
 $qry_string = ;
 $i = 0;
 while ($i  mysql_num_fields($result)) {
 $meta = mysql_fetch_field($result);
 $field_name = $meta-name;
 $field_type = $meta-type;
 if ((qsrequest(search_fd . $i) != ) 
 (qsrequest(search_fd . $i) != *)) {
 $idata = qsrequest(search_fd . $i);
 if (strlen($idata)  1) {
 if ($idata[strlen($idata) - 1] == *)
 {
 $idata = substr($idata, 0,
 strlen($idata) - 1);
 }
 }
 $idata = str_replace(*, %, $idata);
 $irealdata = $idata;
 if (qsrequest(search_optfd.$i) != ) {
   $idata = qsrequest(search_optfd. $i) .
 $idata ;
 }
 $iopt = substr($idata, 0, 2);
 if (($iopt == =) || ($iopt == =)) {
 $iopt = =;
 $irealdata = substr($idata, 2);
 } elseif (($iopt == =) || ($iopt ==
 =)) {
 $iopt = =;
 $irealdata = substr($idata, 2);
 } elseif ($iopt == ==) {
 $iopt = =;
 $irealdata = substr($idata, 2);
 } elseif ($iopt == ) {
 $irealdata = substr($idata, 2);
 } elseif ($iopt == ^^) {
   $iopt = *;
   $idata =  $iopt . $irealdata . $iopt; //
 Contain
   } elseif ($iopt == ^*) {
   $iopt = *;
   $idata =  $irealdata . $iopt; // Start
 With
   } elseif ($iopt == *^) {
   $iopt = *;
   $idata =  $iopt . $irealdata ; // End
 With
 } else {
 $iopt = substr($idata, 0, 1);
 if (($iopt == ) || ($iopt == )

 || ($iopt == =)) {

 $irealdata = substr($idata,1);
 } else {
 $iopt 

Re: [PHP-DB] Please help

2004-09-10 Thread Stuart Felenstein
Now that I'm not getting an invalid error message any
longer, how can I get it to echo the sql statement ?

Stuart
--- Micah Stevens [EMAIL PROTECTED] wrote:

 
 I understand your intent, but that is not really
 what is happening. The code 
 changes I suggested did two things: 
 
 1) Echo's the error statement that mysql produces
 
 2) Echo's the actual SQL statement that is sent to
 the DB
 
 you should be looking at #2 for answers, not your
 intended query. This 
 'actual' query is what I'm referring to. 
 
 -Micah 
 
 On Friday 10 September 2004 10:46 am, Stuart
 Felenstein wrote:
  I think maybe there is an implied where in the
  generated code, but not in my statement.  I'm
 saying
  when I chose ACCFIN (as in the referred error
  message), the join should be looking at the
 referred
  table , value ACCFIN .  e.g. Code_Table.CodeID
  (ACCFIN) = MAIN_Table.CodeID (ACCFIN) return
 label.
 
  Here is the code, and I honestly am not trying to
  argue , just understand. Apologies if I'm
 belabouring
  the point.
 
  ?php
  require('LFW3_connection.php');
  require('qs_functions.php');
  @session_start();
  $err_string = ;
  $strkeyword = ;
  $sql = ;
  $sql_ext = ;
  $fields = array();
  $fields[0] = JobID;
  $fields[1] = CompanyName;
  $fields[2] = CareerCategories;
  $fields[3] = City;
  $fields[4] = States;
  $fields[5] = AreaCode;
  $fields[6] = TaxTerm;
  $fields[7] = PayRate;
  $fields[8] = TravelReq;
  $fields[9] = Details;
  $fields[10] = PostStart;
  $fields[11] = JobTitle;
  $arryitemvalue = array();
  $arryitemvalue[0] = ;
  $arryitemvalue[1] = ;
  $arryitemvalue[2] = ;
  $arryitemvalue[3] = ;
  $arryitemvalue[4] = ;
  $arryitemvalue[5] = ;
  $arryitemvalue[6] = ;
  $arryitemvalue[7] = ;
  $arryitemvalue[8] = ;
  $arryitemvalue[9] = ;
  $arryitemvalue[10] = ;
  $arryitemvalue[11] = ;
  $arryopt = array();
  $arryopt[0] = ;
  $arryopt[1] = ;
  $arryopt[2] = ;
  $arryopt[3] = ;
  $arryopt[4] = ;
  $arryopt[5] = ;
  $arryopt[6] = ;
  $arryopt[7] = ;
  $arryopt[8] = ;
  $arryopt[9] = ;
  $arryopt[10] = ;
  $arryopt[11] = ;
  $sql .=  SELECT ;
  $sql .=VendorJobs.JobID,;
  $sql .=VendorSignUp.CompanyName,;
  $sql .=StaIndTypes.CareerCategories,;
  $sql .=StaUSCities.City,;
  $sql .=USStates.States,;
  $sql .=VendorJobs.AreaCode,;
  $sql .=staTaxTerm.TaxTerm,;
  $sql .=VendorJobs.PayRate,;
  $sql .=staTravelReq.TravelReq,;
  $sql .=VendorJobDetails.Details,;
  $sql .=VendorJobs.PostStart,;
  $sql .=VendorJobs.JobTitle;
  $sql .=  FROM;
  $sql .=VendorJobs;
  $sql .=INNER JOIN VendorSignUp ON
  (VendorJobs.VendorID = VendorSignUp.VendorID);
  $sql .=INNER JOIN StaIndTypes ON
  (VendorJobs.Industry = StaIndTypes.CareerIDs);
  $sql .=LEFT OUTER JOIN StaUSCities ON
  (VendorJobs.LocationCity = StaUSCities.CityID);
  $sql .=LEFT OUTER JOIN USStates ON
  (VendorJobs.LocationState = USStates.StateID);
  $sql .=LEFT OUTER JOIN staTaxTerm ON
  (VendorJobs.TaxTerm = staTaxTerm.TaxTermID);
  $sql .=INNER JOIN staTravelReq ON
  (VendorJobs.TravelReq =
 staTravelReq.TravelReqID);
  $sql .=INNER JOIN VendorJobDetails ON
  (VendorJobs.JobID = VendorJobDetails.JobID);
 
 
  $result = mysql_query($sql .   . $sql_ext . 
 limit
  0,1)  or
  die(mysql_error().br.$sql. .$sql_ext . 
 limit
  0,1br);
  if (isset($_POST[QS_Submit])) {
  $filter_string = ;
  $qry_string = ;
  $i = 0;
  while ($i  mysql_num_fields($result)) {
  $meta = mysql_fetch_field($result);
  $field_name = $meta-name;
  $field_type = $meta-type;
  if ((qsrequest(search_fd . $i) != ) 
  (qsrequest(search_fd . $i) != *)) {
  $idata = qsrequest(search_fd . $i);
  if (strlen($idata)  1) {
  if ($idata[strlen($idata) - 1] ==
 *)
  {
  $idata = substr($idata, 0,
  strlen($idata) - 1);
  }
  }
  $idata = str_replace(*, %,
 $idata);
  $irealdata = $idata;
  if (qsrequest(search_optfd.$i) !=
 ) {
$idata = qsrequest(search_optfd.
 $i) .
  $idata ;
  }
  $iopt = substr($idata, 0, 2);
  if (($iopt == =) || ($iopt ==
 =)) {
  $iopt = =;
  $irealdata = substr($idata, 2);
  } elseif (($iopt == =) || ($iopt ==
  =)) {
  $iopt = =;
  $irealdata = substr($idata, 2);
  } elseif ($iopt == ==) {
  $iopt = =;
  $irealdata = substr($idata, 2);
  } elseif ($iopt == ) {
  $irealdata = substr($idata, 2);
  } elseif ($iopt == ^^) {
$iopt = *;
  $idata =  $iopt . $irealdata . $iopt;
 //
  Contain
} elseif ($iopt == ^*) {
$iopt = *;
  $idata =  $irealdata . $iopt; //
 Start
  With
} elseif ($iopt == 

Re: [PHP-DB] Please help

2004-09-10 Thread Micah Stevens

echo $sql. .$sql_ext;

Read the docs: 

http://www.php.net/echo
http://www.php.net/mysql_query



On Friday 10 September 2004 01:18 pm, you wrote:
 Now that I'm not getting an invalid error message any
 longer, how can I get it to echo the sql statement ?

 Stuart

 --- Micah Stevens [EMAIL PROTECTED] wrote:
  I understand your intent, but that is not really
  what is happening. The code
  changes I suggested did two things:
 
  1) Echo's the error statement that mysql produces
 
  2) Echo's the actual SQL statement that is sent to
  the DB
 
  you should be looking at #2 for answers, not your
  intended query. This
  'actual' query is what I'm referring to.
 
  -Micah
 
  On Friday 10 September 2004 10:46 am, Stuart
 
  Felenstein wrote:
   I think maybe there is an implied where in the
   generated code, but not in my statement.  I'm
 
  saying
 
   when I chose ACCFIN (as in the referred error
   message), the join should be looking at the
 
  referred
 
   table , value ACCFIN .  e.g. Code_Table.CodeID
   (ACCFIN) = MAIN_Table.CodeID (ACCFIN) return
 
  label.
 
   Here is the code, and I honestly am not trying to
   argue , just understand. Apologies if I'm
 
  belabouring
 
   the point.
  
   ?php
   require('LFW3_connection.php');
   require('qs_functions.php');
   @session_start();
   $err_string = ;
   $strkeyword = ;
   $sql = ;
   $sql_ext = ;
   $fields = array();
   $fields[0] = JobID;
   $fields[1] = CompanyName;
   $fields[2] = CareerCategories;
   $fields[3] = City;
   $fields[4] = States;
   $fields[5] = AreaCode;
   $fields[6] = TaxTerm;
   $fields[7] = PayRate;
   $fields[8] = TravelReq;
   $fields[9] = Details;
   $fields[10] = PostStart;
   $fields[11] = JobTitle;
   $arryitemvalue = array();
   $arryitemvalue[0] = ;
   $arryitemvalue[1] = ;
   $arryitemvalue[2] = ;
   $arryitemvalue[3] = ;
   $arryitemvalue[4] = ;
   $arryitemvalue[5] = ;
   $arryitemvalue[6] = ;
   $arryitemvalue[7] = ;
   $arryitemvalue[8] = ;
   $arryitemvalue[9] = ;
   $arryitemvalue[10] = ;
   $arryitemvalue[11] = ;
   $arryopt = array();
   $arryopt[0] = ;
   $arryopt[1] = ;
   $arryopt[2] = ;
   $arryopt[3] = ;
   $arryopt[4] = ;
   $arryopt[5] = ;
   $arryopt[6] = ;
   $arryopt[7] = ;
   $arryopt[8] = ;
   $arryopt[9] = ;
   $arryopt[10] = ;
   $arryopt[11] = ;
   $sql .=  SELECT ;
   $sql .=VendorJobs.JobID,;
   $sql .=VendorSignUp.CompanyName,;
   $sql .=StaIndTypes.CareerCategories,;
   $sql .=StaUSCities.City,;
   $sql .=USStates.States,;
   $sql .=VendorJobs.AreaCode,;
   $sql .=staTaxTerm.TaxTerm,;
   $sql .=VendorJobs.PayRate,;
   $sql .=staTravelReq.TravelReq,;
   $sql .=VendorJobDetails.Details,;
   $sql .=VendorJobs.PostStart,;
   $sql .=VendorJobs.JobTitle;
   $sql .=  FROM;
   $sql .=VendorJobs;
   $sql .=INNER JOIN VendorSignUp ON
   (VendorJobs.VendorID = VendorSignUp.VendorID);
   $sql .=INNER JOIN StaIndTypes ON
   (VendorJobs.Industry = StaIndTypes.CareerIDs);
   $sql .=LEFT OUTER JOIN StaUSCities ON
   (VendorJobs.LocationCity = StaUSCities.CityID);
   $sql .=LEFT OUTER JOIN USStates ON
   (VendorJobs.LocationState = USStates.StateID);
   $sql .=LEFT OUTER JOIN staTaxTerm ON
   (VendorJobs.TaxTerm = staTaxTerm.TaxTermID);
   $sql .=INNER JOIN staTravelReq ON
   (VendorJobs.TravelReq =
 
  staTravelReq.TravelReqID);
 
   $sql .=INNER JOIN VendorJobDetails ON
   (VendorJobs.JobID = VendorJobDetails.JobID);
  
  
   $result = mysql_query($sql .   . $sql_ext . 
 
  limit
 
   0,1)  or
   die(mysql_error().br.$sql. .$sql_ext . 
 
  limit
 
   0,1br);
   if (isset($_POST[QS_Submit])) {
   $filter_string = ;
   $qry_string = ;
   $i = 0;
   while ($i  mysql_num_fields($result)) {
   $meta = mysql_fetch_field($result);
   $field_name = $meta-name;
   $field_type = $meta-type;
   if ((qsrequest(search_fd . $i) != ) 
   (qsrequest(search_fd . $i) != *)) {
   $idata = qsrequest(search_fd . $i);
   if (strlen($idata)  1) {
   if ($idata[strlen($idata) - 1] ==
 
  *)
 
   {
   $idata = substr($idata, 0,
   strlen($idata) - 1);
   }
   }
   $idata = str_replace(*, %,
 
  $idata);
 
   $irealdata = $idata;
   if (qsrequest(search_optfd.$i) !=
 
  ) {
 
 $idata = qsrequest(search_optfd.
 
  $i) .
 
   $idata ;
   }
   $iopt = substr($idata, 0, 2);
   if (($iopt == =) || ($iopt ==
 
  =)) {
 
   $iopt = =;
   $irealdata = substr($idata, 2);
   } elseif (($iopt == =) || ($iopt ==
   =)) {
   $iopt = =;
   $irealdata = substr($idata, 2);
   } elseif ($iopt == ==) {
   $iopt = =;
   $irealdata = substr($idata, 2);
   } elseif ($iopt == ) {
   $irealdata = 

Re: [PHP-DB] Please help

2004-09-09 Thread Stuart Felenstein
Just getting back to this thing.  There are 3 files
involved, search.php, connections.php and
functions.php.

I searched through all and couldn't find the meaning
of the $sql_ext.   $sql is just the sql statement I
inserted into the code.  

Great that I can't get a response from the company.  
If anyone thinks it would be useful to post the code I
will. That is if anyone would want to see and look at
it. 

The weird thing is searching on one table is great. 
The list (all records) works great.  The problem
starts when I insert all my joins.  Now I've tested
and retested the query and I know it's fine.

Thank you ,
Stuart


--- Steve Davies [EMAIL PROTECTED] wrote:

 What's contained in $sql and $sql_ext ???
 
 
 Stuart Felenstein wrote:
 
 I'm using a product called dbqwiksite pro.  PHP
 generator for PHP - MySQL 
 
 The code seems to be working fine except in my
 search
 page where I receive an invalid query
 
 $result = mysql_query($sql .   . $sql_ext . 
 limit
 0,1)
 or die(Invalid query);
 
 This is the place I where the code is taking the
 die
 path.
 I'm guessing something belongs between the
 quotation
 marks , just not sure.
 
 Anyone ?
 
 Thank you
 Stuart
 
   
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP-DB] Please help

2004-09-08 Thread Peter Ellis
What are the variables $sql and $sql_ext set to?  The query format is
fine.  It's probably in your variables.
-- 
Peter Ellis - [EMAIL PROTECTED]
Web Design and Development Consultant
naturalaxis | http://www.naturalaxis.com/

On Wed, 2004-09-08 at 12:29 -0700, Stuart Felenstein wrote:
 I'm using a product called dbqwiksite pro.  PHP
 generator for PHP - MySQL 
 
 The code seems to be working fine except in my search
 page where I receive an invalid query
 
 $result = mysql_query($sql .   . $sql_ext .  limit
 0,1)
 or die(Invalid query);
 
 This is the place I where the code is taking the die
 path.
 I'm guessing something belongs between the quotation
 marks , just not sure.
 
 Anyone ?
 
 Thank you
 Stuart

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



RE: [PHP-DB] Please help

2004-09-08 Thread Peter Lovatt
HI

try 

 $result = mysql_query($sql .   . $sql_ext .  limit 0,1)
 or die(Invalid query.mysql_error());

which will give more detail on the error.

HTH

Peter

 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
 Sent: 08 September 2004 20:29
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Please help
 
 
 I'm using a product called dbqwiksite pro.  PHP
 generator for PHP - MySQL 
 
 The code seems to be working fine except in my search
 page where I receive an invalid query
 
 $result = mysql_query($sql .   . $sql_ext .  limit
 0,1)
 or die(Invalid query);
 
 This is the place I where the code is taking the die
 path.
 I'm guessing something belongs between the quotation
 marks , just not sure.
 
 Anyone ?
 
 Thank you
 Stuart
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP-DB] Please help

2004-09-08 Thread Stuart Felenstein
Not sure what the varialbe are set too.  Going through
the code and rebuilding the query.
Post on hold to further notice :).

Stuart
--- Peter Ellis [EMAIL PROTECTED] wrote:

 What are the variables $sql and $sql_ext set to? 
 The query format is
 fine.  It's probably in your variables.
 -- 
 Peter Ellis - [EMAIL PROTECTED]
 Web Design and Development Consultant
 naturalaxis | http://www.naturalaxis.com/
 
 On Wed, 2004-09-08 at 12:29 -0700, Stuart Felenstein
 wrote:
  I'm using a product called dbqwiksite pro.  PHP
  generator for PHP - MySQL 
  
  The code seems to be working fine except in my
 search
  page where I receive an invalid query
  
  $result = mysql_query($sql .   . $sql_ext . 
 limit
  0,1)
  or die(Invalid query);
  
  This is the place I where the code is taking the
 die
  path.
  I'm guessing something belongs between the
 quotation
  marks , just not sure.
  
  Anyone ?
  
  Thank you
  Stuart
 
 
 

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



Re: [PHP-DB] Please help

2004-09-08 Thread Micah Stevens

Change the code to this:

$result = mysql_query($sql .   . $sql_ext .  limit 0,1)  or 
die(mysql_error().br.$sql. .$sql_ext .  limit 0,1br);

And you'll get the error from mysql and a copy of the actual query. Without 
that, it's pretty tough to help. 

-Micah 

On Wednesday 08 September 2004 12:29 pm, Stuart Felenstein wrote:
 I'm using a product called dbqwiksite pro.  PHP
 generator for PHP - MySQL

 The code seems to be working fine except in my search
 page where I receive an invalid query

 $result = mysql_query($sql .   . $sql_ext .  limit
 0,1)
 or die(Invalid query);

 This is the place I where the code is taking the die
 path.
 I'm guessing something belongs between the quotation
 marks , just not sure.

 Anyone ?

 Thank you
 Stuart

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



RE: [PHP-DB] Please help

2004-09-08 Thread Gary Every
What exactly is in the $sql and $sql_ext??

Try to put it into a variable so you can print out what you're sending
to the DB

Such as:
$query = $sql .   . $sql_ext .  limit 0,1;
Echo $query . BR;

If your $sql and $sql_ext combine to make a valid sql query, the   is
just putting a space inside the query, and it is valid

Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!


-Original Message-
From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 08, 2004 2:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Please help


I'm using a product called dbqwiksite pro.  PHP
generator for PHP - MySQL 

The code seems to be working fine except in my search
page where I receive an invalid query

$result = mysql_query($sql .   . $sql_ext .  limit
0,1)
or die(Invalid query);

This is the place I where the code is taking the die
path.
I'm guessing something belongs between the quotation
marks , just not sure.

Anyone ?

Thank you
Stuart

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

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



Re: [PHP-DB] Please help

2004-09-08 Thread Steve Davies
What's contained in $sql and $sql_ext ???
Stuart Felenstein wrote:
I'm using a product called dbqwiksite pro.  PHP
generator for PHP - MySQL 

The code seems to be working fine except in my search
page where I receive an invalid query
$result = mysql_query($sql .   . $sql_ext .  limit
0,1)
or die(Invalid query);
This is the place I where the code is taking the die
path.
I'm guessing something belongs between the quotation
marks , just not sure.
Anyone ?
Thank you
Stuart
 

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


RE: [PHP-DB] Please help - Managing relational tables using PHP

2003-01-02 Thread Ryan Jameson (USA)
You need to realize that phpMyAdmin is a database manangement tool, not a database. So 
I'll answer your questions based on the mySQL database ... 

1. MySQL 3.23.43b introduced a table type of InnoDB which is the first to allow 
foreign key constraints. http://www.mysql.com/doc/en/SEC448.html  ... However, you do 
not need to enforce constraints to have a relationship. I just assume that's what 
you're getting at.

2. Yes, if you enforce constraints with the CASCADE option it will. ..see same 
document: http://www.mysql.com/doc/en/SEC448.html


... Now the catch, my version of phpMyAdmin 2.3.0 does not allow me to choose the 
table type of InnoDB, even though my database is version 3.23.54. So I assume 
phpMyAdmin does not allow one to manage these attributes. Someone please correct me if 
I'm wrong.

 Ryan



-Original Message-
From: Phanivas Vemuri [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 12:50 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] Please help - Managing relational tables using PHP


hi all,
1. How does phpMyAdmin manage tables with one to many or many to one 
relation ships. Is there any documentation about this.
--or-
2. Does phpMyAdmin support editing data from more than one table that have a 
one to many or many to one relationship.

Thanks and Wish you a happy new year,
Phani.

_
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus


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


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




RE: [PHP-DB] Please help - Managing relational tables using PHP

2003-01-02 Thread Phanivas Vemuri
Dear Mr. Ryan,
May be I did not present my question clearly to you. My question in detail 
is ...
-- Does phpMyAdmin supports / allow / interface, editing data from one to 
many or ,many to many related tables, using a single phpMyAdmin 
interface( a single HTML page)

I have a (primary) table and one of its fields(category) has one or many 
values , all these values are also listed in another(secondary) table. I 
would like to know if phpMyAdmin provides any interface such that those 
values from the secondary table appears(listed) (for example : as a Form) in 
the field of the primary table.

PrimaryTable(X,Y,category,Z) pk:X
SecondaryTable(category)pk:category
I am not intending to enforce referential integrity. My question is just 
about the interfacing.
Thank you,
Phani.


From: Ryan Jameson (USA) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Please help - Managing relational tables using PHP
Date: Thu, 2 Jan 2003 13:32:15 -0700

You need to realize that phpMyAdmin is a database manangement tool, not a 
database. So I'll answer your questions based on the mySQL database ...

1. MySQL 3.23.43b introduced a table type of InnoDB which is the first to 
allow foreign key constraints. http://www.mysql.com/doc/en/SEC448.html  ... 
However, you do not need to enforce constraints to have a relationship. I 
just assume that's what you're getting at.

2. Yes, if you enforce constraints with the CASCADE option it will. ..see 
same document: http://www.mysql.com/doc/en/SEC448.html


... Now the catch, my version of phpMyAdmin 2.3.0 does not allow me to 
choose the table type of InnoDB, even though my database is version 
3.23.54. So I assume phpMyAdmin does not allow one to manage these 
attributes. Someone please correct me if I'm wrong.

 Ryan



-Original Message-
From: Phanivas Vemuri [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 12:50 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] Please help - Managing relational tables using PHP


hi all,
1. How does phpMyAdmin manage tables with one to many or many to one
relation ships. Is there any documentation about this.
--or-
2. Does phpMyAdmin support editing data from more than one table that have 
a
one to many or many to one relationship.

Thanks and Wish you a happy new year,
Phani.

_
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus


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


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


_
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus


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



RE: [PHP-DB] Please help - Managing relational tables using PHP

2003-01-02 Thread Michael Knauf/Niles

Well, you can use the SQL tab to write a sql statement to do whatever you
want, but no, the graphical interface doesn't appear to do that.



   

  Phanivas Vemuri

  [EMAIL PROTECTED]To:   [EMAIL PROTECTED], 
[EMAIL PROTECTED]
  m   cc: 

   Subject:  RE: [PHP-DB] Please help - 
Managing relational tables using PHP   
  01/02/03 04:34 PM

   

   





Dear Mr. Ryan,
May be I did not present my question clearly to you. My question in detail
is ...
-- Does phpMyAdmin supports / allow / interface, editing data from one to

many or ,many to many related tables, using a single phpMyAdmin
interface( a single HTML page)

I have a (primary) table and one of its fields(category) has one or many
values , all these values are also listed in another(secondary) table. I
would like to know if phpMyAdmin provides any interface such that those
values from the secondary table appears(listed) (for example : as a Form)
in
the field of the primary table.

PrimaryTable(X,Y,category,Z) pk:X
SecondaryTable(category)pk:category
I am not intending to enforce referential integrity. My question is just
about the interfacing.
Thank you,
Phani.


From: Ryan Jameson (USA) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Please help - Managing relational tables using PHP
Date: Thu, 2 Jan 2003 13:32:15 -0700

You need to realize that phpMyAdmin is a database manangement tool, not a
database. So I'll answer your questions based on the mySQL database ...

1. MySQL 3.23.43b introduced a table type of InnoDB which is the first to
allow foreign key constraints. http://www.mysql.com/doc/en/SEC448.html
...
However, you do not need to enforce constraints to have a relationship. I
just assume that's what you're getting at.

2. Yes, if you enforce constraints with the CASCADE option it will. ..see
same document: http://www.mysql.com/doc/en/SEC448.html


... Now the catch, my version of phpMyAdmin 2.3.0 does not allow me to
choose the table type of InnoDB, even though my database is version
3.23.54. So I assume phpMyAdmin does not allow one to manage these
attributes. Someone please correct me if I'm wrong.

 Ryan



-Original Message-
From: Phanivas Vemuri [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 12:50 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] Please help - Managing relational tables using PHP


hi all,
1. How does phpMyAdmin manage tables with one to many or many to one
relation ships. Is there any documentation about this.
 --or-
2. Does phpMyAdmin support editing data from more than one table that have

a
one to many or many to one relationship.

Thanks and Wish you a happy new year,
Phani.

_
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus


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


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


_
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus


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

Niles Audio Corporation
This mail is confidential







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




Re: [PHP-DB] please help!

2002-04-23 Thread szii

You're not evaluating the variable correctly...
Instead of... 
$site = .row['site'].;   
It should be...
$site = $row[site];
Or
$site = $row['site']

I'm not sure why you have leading and trailing
periods, either.  Looks like you were trying to 
do string appends, but they're not being used
correctly

'Luck

-Szii

- Original Message - 
From: Evans, Josh [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, April 23, 2002 11:26 AM
Subject: [PHP-DB] please help!


 Database: sites
 
 I have to columns: id and site. I will have approx 800 entries in the db
 when I am finished and what I want it to do and start with 1st entry and
 ping the site and display in a table on the screen if it was able to ping
 site or not.
 
 This is what I have so far. My problem is I am not sure how to make it
 select a entry, perform the ping, record the results, and then continue to
 the next entry.
 
 ?
 $db = mysql_connect(localhost,,) or die(Problem connecting);
 mysql_select_db(josh) or die(Problem selecting database);
 $query = SELECT * FROM josh.sites;
 $result = mysql_query($query) or die (Query failed);
 $numofrows = mysql_num_rows($result);
 for($i = 0; $i  $numofrows; $i++) {
 $row = mysql_fetch_array($result);
 if($i % 2) { //this means if there is a remainder
 
 $site = .row['site'].;    its not pulling a site from the
 database?
 
 
 $host1 = `ping -n 4 $site`;
 
 if (eregi(reply, $host1)) {
 echo $site is up!;
 } else {
 echo ($site is down!);
 }
 
 echo (p);
 ?
 
 Please Help!
 
 Josh Evans
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


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




Re: [PHP-DB] Please help count ?

2002-04-04 Thread Shane Wright

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


you can do this...

$myvar = ecplode(' ', $postcode);
$firsthalf = $myvar[0];

But not everyone puts the space in there

S

On Thursday 04 April 2002 5:29 pm, Dave Carrera wrote:
 Hi All



 I have a variable returned by my application.



 For clarity it is a post code so result could be



 EX3 T56 or BG56 G67 or CA2 123



 But I only need the first bit of the postcode to continue my search.



 How do I set my var to only include the first bit of the postcode.



 It is returned in the format shown, so my question might be how I read
 only the first bit before the space.



 I fully appreciate any kind of help with this and as always thank you in
 advance for any help.







 Dave Carrera

 Php Developer

 http://davecarrera.freelancers.net

 http://www.davecarrera.com

- -- 
Shane
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8rH/75DXg6dCMBrQRAlEUAJ9R/jfY0Ufdj5yCSiTRw7qB81B3TwCeJELP
GW03u2HKvFXy9fDEEdV1lfg=
=xALC
-END PGP SIGNATURE-


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




RE: [PHP-DB] Please help count ?

2002-04-04 Thread Rick Emery

$post = ereg_replace((.*) ,\\1, $old_post);

If you want to search mysql for this that is something else

-Original Message-
From: Dave Carrera [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 04, 2002 10:29 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Please help count ?


Hi All

 

I have a variable returned by my application.

 

For clarity it is a post code so result could be

 

EX3 T56 or BG56 G67 or CA2 123

 

But I only need the first bit of the postcode to continue my search.

 

How do I set my var to only include the first bit of the postcode.

 

It is returned in the format shown, so my question might be how I read
only the first bit before the space.

 

I fully appreciate any kind of help with this and as always thank you in
advance for any help.

 

 

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 


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




RE: [PHP-DB] Please help count ?

2002-04-04 Thread Rosser, Chris

Dave,

Try:

$postcode_parts = explode( , $postcode);

The first part of the postcode will be available in $postcode_parts[0].


- Chris


 -Original Message-
 From: Dave Carrera [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, April 04, 2002 5:29 PM
 To:   [EMAIL PROTECTED]
 Subject:  [PHP-DB] Please help count ?
 
 Hi All
 
  
 
 I have a variable returned by my application.
 
  
 
 For clarity it is a post code so result could be
 
  
 
 EX3 T56 or BG56 G67 or CA2 123
 
  
 
 But I only need the first bit of the postcode to continue my search.
 
  
 
 How do I set my var to only include the first bit of the postcode.
 
  
 
 It is returned in the format shown, so my question might be how I read
 only the first bit before the space.
 
  
 
 I fully appreciate any kind of help with this and as always thank you in
 advance for any help.
 
  
 
  
 
  
 
 Dave Carrera
 
 Php Developer
 
 http://davecarrera.freelancers.net
 
 http://www.davecarrera.com
 
  
 
  
 

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




RE: [PHP-DB] Please help me! :(

2002-03-23 Thread Howard Picken

Can I ask why you're not using autoincrement for your
id field? If you used this you would never have the problem
your having.

Everytime a record is added it will increment the id field
by one, so you don't have to use all the code your using.

Howard

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 24 March 2002 3:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Please help me! :(


I have a site where things in the database have ids.  When something new is
added, it gets an id one higher than the highest existing id.  I use code
something like this:

$gethighestid = mysql_fetch_array(mysql_query(select id from table order by
id desc limit 1));
$tobeid = $gethighestid[id]+1;
mysql_query(insert into table(id,othercolumn,othercolumn2)
values('$tobeid','something','something'));

The thing is, I just got two rows with duplicate ids.  Aparantley, two
people must of added two things at just the right times to make the same id.
Is there any way that will reduce, or eliminate, the time gap between
getting id and inserting?

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



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




Re: [PHP-DB] PLEASE HELP !!!!!!!

2002-03-14 Thread DL Neil

Manual reference:
http://www.php.net/manual/en/function.mysql-connect.php

resource mysql_connect ( [string server [, string username [, string
password [, bool new_link)

Seeing it is not a web page you're connecting to, try removing the
http://;.

localhost has particular meaning within the IP conventions - if
cgi.xyz.com is remote then only use that server's name and remove the
'local' designation, ie use the name from your computer's perspective,
not the remote computer's perspective. Use PING to ascertain that you
have the server's name expressed correctly.

The default values are server =  'localhost:3306'  which may be
causing some confusion here. I recommend simplifying by leaving out the
port number (3306) for now - MySQL knows that (hopefully) and thus the
remote computer's RDBMS should be 'listening' on that port - if it's
not, we'll have to get downer-and-dirtier...

Let us know how you get on!
=dn

- Original Message -
From: Beau Lebens [EMAIL PROTECTED]
To: 'Inter-Media Webmaster' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: 14 March 2002 00:21
Subject: RE: [PHP-DB] PLEASE HELP !!!


 try an IP


 // -Original Message-
 // From: Inter-Media Webmaster [mailto:[EMAIL PROTECTED]]
 // Sent: Thursday, 14 March 2002 6:00 AM
 // To: [EMAIL PROTECTED]
 // Subject: [PHP-DB] PLEASE HELP !!!
 //
 //
 // PLEASE HELP !!!
 // HOW I CAN GET CONNETCTION TO REMOTE HOST IN OTHER SERVER WITH
 // mysql_connect();
 // e.g.
 // my php file is in www.abc.com/index.php
 // mysql server is localhost on cgi.xyz.com
 //
 // can i do something like this
 //
 // mysql_connect(http://cgi.xyz.com:localhost:3306;, username,
 // password);
 //
 // PLEASE ANSWER to [EMAIL PROTECTED]
 //
 //
 //
 //
 //
 // --
 // PHP Database Mailing List (http://www.php.net/)
 // To unsubscribe, visit: http://www.php.net/unsub.php
 //

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




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




Re: [PHP-DB] Please help, On phpnuke and phpgroupware.

2002-01-10 Thread Jason Wong

On Thursday 10 January 2002 21:28, HiM wrote:

 I am sorry that last message haven't give the URL...:(

 http://nori.dns2go.com:8080/phpnuke/html/admin.php
 http://nori.dns2go.com:8080/phpgroupware/setup/config.php

 I was trying to use to phpnuke system and also the phpgroupware.
 I have followed the instruction listed in INSTALL step by step.
 But I don't know why there's so many error even in phpnuke / phpgroupware

 I am using Windows2000 server and apache, php 4.1.1 and mysql 3.23

The recommended php.ini settings for php 4.1.1 are more secure than previous 
versions BUT will break a lot of the existing PHP applications. Either change 
the php.ini settings to match those of an earlier version of PHP (eg 4.0.6) 
or wait until the author of the apps in question upgrade them to make it 
compatible with 4.1.1(!)


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
I don't want people to love me.  It makes for obligations.
-- Jean Anouilh
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Please help, On phpnuke and phpgroupware.

2002-01-10 Thread HiM

Jason,
But after downgrade to 4.0.6, is there any new feature I can't use?

Nori Chan

- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 10, 2002 9:41 PM
Subject: Re: [PHP-DB] Please help, On phpnuke and phpgroupware.


 On Thursday 10 January 2002 21:28, HiM wrote:

  I am sorry that last message haven't give the URL...:(
 
  http://nori.dns2go.com:8080/phpnuke/html/admin.php
  http://nori.dns2go.com:8080/phpgroupware/setup/config.php
 
  I was trying to use to phpnuke system and also the phpgroupware.
  I have followed the instruction listed in INSTALL step by step.
  But I don't know why there's so many error even in phpnuke /
phpgroupware
 
  I am using Windows2000 server and apache, php 4.1.1 and mysql 3.23

 The recommended php.ini settings for php 4.1.1 are more secure than
previous
 versions BUT will break a lot of the existing PHP applications. Either
change
 the php.ini settings to match those of an earlier version of PHP (eg
4.0.6)
 or wait until the author of the apps in question upgrade them to make it
 compatible with 4.1.1(!)


 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk

 /*
 I don't want people to love me.  It makes for obligations.
 -- Jean Anouilh
 */

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Please help, On phpnuke and phpgroupware.

2002-01-10 Thread Jason Wong

On Thursday 10 January 2002 21:53, HiM wrote:
 Jason,
 But after downgrade to 4.0.6, is there any new feature I can't use?

 Nori Chan


If you're going to be using only PHPNuke and/or PHPGroupware and they haven't 
been updated for 4.1.1 then they won't be using any of the new features of 
4.1.1.

Read the changelog for 4.1.1 to see what's added and fixed.


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Let's not complicate our relationship by trying to communicate with each 
other.
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Please help, On phpnuke and phpgroupware.

2002-01-10 Thread HiM

Jason,
phpNuke problem fixed after downgrade to 4.0.6
Thanks !
And I am still solving to problem with phpgroupware.

Nori
-
- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 10, 2002 10:07 PM
Subject: Re: [PHP-DB] Please help, On phpnuke and phpgroupware.


 On Thursday 10 January 2002 21:53, HiM wrote:
  Jason,
  But after downgrade to 4.0.6, is there any new feature I can't use?
 
  Nori Chan


 If you're going to be using only PHPNuke and/or PHPGroupware and they
haven't
 been updated for 4.1.1 then they won't be using any of the new features of
 4.1.1.

 Read the changelog for 4.1.1 to see what's added and fixed.


 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk

 /*
 Let's not complicate our relationship by trying to communicate with each
 other.
 */

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Please help, On phpnuke and phpgroupware.

2002-01-10 Thread Jason Wong

On Thursday 10 January 2002 22:15, HiM wrote:
 Jason,
 phpNuke problem fixed after downgrade to 4.0.6

Glad to hear.

 Thanks !

You're welcome :)



-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Falling in love is a lot like dying.  You never get to do it enough to
become good at it.
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Please help asap

2002-01-04 Thread Bogdan Stancescu

In the printf() line after 5 6 7 you try to print %s 24 times but only provide 10 
values. That may have something to do with it...

Bogdan

Jeff Moncrieff wrote:

 Hello

  I am trying  make a script fatch my data form my mysql database. I use
 this script but when execute it is says
 Warning: printf(): too few arguments in
 /home/httpd/html/larken/database.php on line 47

 any hints
 Thanks Jeff

 html

 body

 ?php

 $db = mysql_connect(, root);

 mysql_select_db(larken,$db);

 $result = mysql_query(SELECT * FROM custgeninfo,$db);

 echo table border=1\n;

 echo trtdName of contact/tdtdName of company/tdtd
 Address/tdtdPostal Code/tdtdFormat Mail/tdtdEmail
 
Addresstdmodel/tdtdComment/tdtdtelephone/tdtdNotes/tdtdCounty/tdtd

 ID /td/tr\n;

 while ($myrow = mysql_fetch_row($result)) {

 //   1 2 34
 5  6   7
 
printf(trtd%s%s/tdtd%s%s/tdtd%s%s/tdtd%s%s%s/tdtd%s%s/tdtd%s/tdtd%s%s%s/tdtd%s/tdtd%s%s/tdtd%s/tdtd%s%s%s%s%s/td/tr\n,$myrow[1],$myrow[2],$myrow[3],$myrow[4],$myrow[5],$myrow[6],$myrow[7],$myrow[8],$myrow[9],$myrow[10]);

 }

 echo /table

 ?

 /body

 /html

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Please Help Me! thanks!!

2001-11-11 Thread Denny Suvanto

Try using fsockopen() function :
$file = fsockopen (www.yahoo.com, 80, $err_num,
$err_msg, 30);

You can find more informations about this fuction in
http://www.php.net/manual/en/function.fsockopen.php

May it help you.

Andy
www.mediahostnet.com

--- G [EMAIL PROTECTED] wrote:  Hello! i
would like to useing fopen() fuction to
 open the other Url,
 but i am using a shared server now. When i useing
 fopen() or file()
 fuctions, always have a error message:
 
 Warning: php_hostconnect: connect failed in
 /usr/xxx/xxx/xxx/html/test.php
 on line 3
 
 Warning: file(http://www.yahoo.com;) - Bad file
 descriptor in
 /usr/xxx/xxx/xxx/html/test.php on line 3
 
 How can i do?have any other fuctions can do that?
 Thank You Very Much!!
 
 
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
  

__
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and Music 
Charts
http://uk.my.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Please help!

2001-08-22 Thread Marios Moutzouris


use that counter variable. check if its equal to 2 before incrementing, if
it is then BR and reset to zero, otherwise just increment.

if ($counter==2) {
echo BR;
$counter=0;
} else {
$counter++;
}

marios
- Original Message - Original Message -
From: Matt C [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 22, 2001 9:37 PM
Subject: [PHP-DB] Please help!


 Thats my code!

 What I want to be able to do is have it so instead of one column there are
 two columns of pictures:


 pic1  | pic2
 pic3  | pic4

 etc..


 How can I do this?

 Thanks in advance!




 ?php

 $mysql_access = mysql_connect(, **, *);
 mysql_select_db(*, $mysql_access);

 $query = SELECT * FROM Pictures;
 $result = mysql_query($query, $mysql_access);

 if(mysql_num_rows($result)) {
   $counter = 0;
 while($row = mysql_fetch_row($result)) {

 printf(a href=\http://www.charmed-guide.com/pictures/$row[2].jpg\;
 target=_blank\n);
 printf(img src=\http://www.charmed-guide.com/pictures/$row[2]_th.jpg\;
 border=0\n);
 printf(/ap\n);

 $counter++;
 }

 }
 ?

 _
 Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Please help!

2001-08-22 Thread Justin Buist

I realize this is trivial... but if you're using things like the code
below alot it can clean things up a bit by using:

if (($counter % 2) == 0  ($counter != 0))
echo BR;
$counter++;
echo img src=whatever...\n;

Just reads easier... less branching, less code.  In an ideal world it'd
optimize into machine code better than the below snippet too -- but that's
get anal retentive about the situtation :)

Justin Buist
Trident Technology, Inc.
4700 60th St. SW, Suite 102
Grand Rapids, MI  49512
Ph. 616.554.2700
Fx. 616.554.3331
Mo. 616.291.2612

On Wed, 22 Aug 2001, Marios Moutzouris wrote:


 use that counter variable. check if its equal to 2 before incrementing, if
 it is then BR and reset to zero, otherwise just increment.

 if ($counter==2) {
 echo BR;
 $counter=0;
 } else {
 $counter++;
 }


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Please help!

2001-08-22 Thread phpnet

you do not need a counter, just use a 2 column table


| Thats my code!
| 
| What I want to be able to do is have it so instead of one column there are 
| two columns of pictures:
| 
| 
| pic1  | pic2
| pic3  | pic4
| 
| etc..
| 
| 
| How can I do this?
| 
| Thanks in advance!
| 
| 
| 
| 
| ?php
| 
| $mysql_access = mysql_connect(, **, *);
| mysql_select_db(*, $mysql_access);
| 
| $query = SELECT * FROM Pictures;
| $result = mysql_query($query, $mysql_access);
| 
| if(mysql_num_rows($result)) {
|   $counter = 0;
| while($row = mysql_fetch_row($result)) {
| 
| printf(a href=\http://www.charmed-guide.com/pictures/$row[2].jpg\; 
| target=_blank\n);
| printf(img src=\http://www.charmed-guide.com/pictures/$row[2]_th.jpg\; 
| border=0\n);
| printf(/ap\n);
| 
| $counter++;
| }
| 
| }
| ?
| 
| _
| Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
| 
| 
| -- 
| PHP Database Mailing List (http://www.php.net/)
| To unsubscribe, e-mail: [EMAIL PROTECTED]
| For additional commands, e-mail: [EMAIL PROTECTED]
| To contact the list administrators, e-mail: [EMAIL PROTECTED]
| 
| 

[EMAIL PROTECTED]

SeaPortNetHosting: Reliable Web Hosting
Plans from $17.95 www.yourname.com
http://www.SeaPortNet.com/
1(209)551-7028 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] PLEASE HELP! Problem with ODBC string insert

2001-07-15 Thread Matthew Loff


It might help us to see exactly what the query is...

Could you insert an echo statement and let us know what SQL query it's
producing?

echo 
INSERT INTO News
   (NewsDate,NewsTitle,NewsText)
VALUES
('$NowDate','$NewsTitle','$NewsText')
;


-Original Message-
From: AKA Hook [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, July 15, 2001 1:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PLEASE HELP! Problem with ODBC string insert


I am using an Access DBASE and trying to insert text from a form field.
When I use quotes in my text the code errors out, otherwise it works
fine. I have Magic Quotes turned on which is supposed to fix this
problem but IT DOES NOT!

I have posted in several forums but no one has been able to help me!
Here is my code:


--

$NowDate = date(m/d/y);

$DBASE = odbc_connect(mno,admin,admin);
$getnews = odbc_exec($DBASE,

INSERT INTO News
   (NewsDate,NewsTitle,NewsText)
VALUES
('$NowDate','$NewsTitle','$NewsText')

);

Here is the error when using quotes in the NewsText form field:



Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax
error (missing operator) in query expression ''can\'t use quotes!')'.,
SQL state 37000 in SQLExecDirect in W:\www\clanmno\news_post2.php on
line 22

Thanks in advance...





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] PLEASE HELP! Problem with ODBC string insert

2001-07-15 Thread AKA Hook

Here is the echo output.

UPDATE News SET NewsTitle = 'Text',
NewsText = 'can\'t use quotes!' WHERE NewsID = 16


Matthew Loff [EMAIL PROTECTED] wrote in message
000e01c10d89$6fa576c0$0100a8c0@bang">news:000e01c10d89$6fa576c0$0100a8c0@bang...

 It might help us to see exactly what the query is...

 Could you insert an echo statement and let us know what SQL query it's
 producing?

 echo 
 INSERT INTO News
(NewsDate,NewsTitle,NewsText)
 VALUES
 ('$NowDate','$NewsTitle','$NewsText')
 ;


 -Original Message-
 From: AKA Hook [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, July 15, 2001 1:03 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] PLEASE HELP! Problem with ODBC string insert


 I am using an Access DBASE and trying to insert text from a form field.
 When I use quotes in my text the code errors out, otherwise it works
 fine. I have Magic Quotes turned on which is supposed to fix this
 problem but IT DOES NOT!

 I have posted in several forums but no one has been able to help me!
 Here is my code:
 
 
 --

 $NowDate = date(m/d/y);

 $DBASE = odbc_connect(mno,admin,admin);
 $getnews = odbc_exec($DBASE,
 
 INSERT INTO News
(NewsDate,NewsTitle,NewsText)
 VALUES
 ('$NowDate','$NewsTitle','$NewsText')
 
 );

 Here is the error when using quotes in the NewsText form field:
 
 
 
 Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax
 error (missing operator) in query expression ''can\'t use quotes!')'.,
 SQL state 37000 in SQLExecDirect in W:\www\clanmno\news_post2.php on
 line 22

 Thanks in advance...





 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] PLEASE HELP! Problem with ODBC string insert

2001-07-15 Thread Matthew Loff



That looks like a valid query to me...  I know this would break SQL92
standard, but have you tried enclosing the values in double quotes?  I
know that's valid with MySQL...  

I don't have any other suggestions... Does anyone else?


-Original Message-
From: AKA Hook [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, July 15, 2001 3:56 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] PLEASE HELP! Problem with ODBC string insert


Here is the echo output.

UPDATE News SET NewsTitle = 'Text',
NewsText = 'can\'t use quotes!' WHERE NewsID = 16


Matthew Loff [EMAIL PROTECTED] wrote in message
000e01c10d89$6fa576c0$0100a8c0@bang">news:000e01c10d89$6fa576c0$0100a8c0@bang...

 It might help us to see exactly what the query is...

 Could you insert an echo statement and let us know what SQL query it's

 producing?

 echo 
 INSERT INTO News
(NewsDate,NewsTitle,NewsText)
 VALUES
 ('$NowDate','$NewsTitle','$NewsText')
 ;


 -Original Message-
 From: AKA Hook [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, July 15, 2001 1:03 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] PLEASE HELP! Problem with ODBC string insert


 I am using an Access DBASE and trying to insert text from a form 
 field. When I use quotes in my text the code errors out, otherwise it 
 works fine. I have Magic Quotes turned on which is supposed to fix 
 this problem but IT DOES NOT!

 I have posted in several forums but no one has been able to help me! 
 Here is my code:
 --
 --
 
 --

 $NowDate = date(m/d/y);

 $DBASE = odbc_connect(mno,admin,admin);
 $getnews = odbc_exec($DBASE,
 
 INSERT INTO News
(NewsDate,NewsTitle,NewsText)
 VALUES
 ('$NowDate','$NewsTitle','$NewsText')
 
 );

 Here is the error when using quotes in the NewsText form field:
 --
 --
 
 
 Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax
 error (missing operator) in query expression ''can\'t use quotes!')'.,
 SQL state 37000 in SQLExecDirect in W:\www\clanmno\news_post2.php on
 line 22

 Thanks in advance...





 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] PLEASE HELP! Problem with ODBC string insert

2001-07-15 Thread AKA Hook

I tried double quotes and many different combinations of single and
double but nothing has worked.

There HAS to be an answer out there! Do certain SQL statements just not work
in PHP / Access? Is this a bug in Access or PHP?

If I can't get this to work then I won't be able to use PHP for this site!
Someone please shed some light on this!

Matthew Loff [EMAIL PROTECTED] wrote in message
001701c10dae$53146280$0100a8c0@bang">news:001701c10dae$53146280$0100a8c0@bang...


 That looks like a valid query to me...  I know this would break SQL92
 standard, but have you tried enclosing the values in double quotes?  I
 know that's valid with MySQL...

 I don't have any other suggestions... Does anyone else?


 -Original Message-
 From: AKA Hook [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, July 15, 2001 3:56 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] PLEASE HELP! Problem with ODBC string insert


 Here is the echo output.

 UPDATE News SET NewsTitle = 'Text',
 NewsText = 'can\'t use quotes!' WHERE NewsID = 16


 Matthew Loff [EMAIL PROTECTED] wrote in message
 000e01c10d89$6fa576c0$0100a8c0@bang">news:000e01c10d89$6fa576c0$0100a8c0@bang...
 
  It might help us to see exactly what the query is...
 
  Could you insert an echo statement and let us know what SQL query it's

  producing?
 
  echo 
  INSERT INTO News
 (NewsDate,NewsTitle,NewsText)
  VALUES
  ('$NowDate','$NewsTitle','$NewsText')
  ;
 
 
  -Original Message-
  From: AKA Hook [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, July 15, 2001 1:03 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] PLEASE HELP! Problem with ODBC string insert
 
 
  I am using an Access DBASE and trying to insert text from a form
  field. When I use quotes in my text the code errors out, otherwise it
  works fine. I have Magic Quotes turned on which is supposed to fix
  this problem but IT DOES NOT!
 
  I have posted in several forums but no one has been able to help me!
  Here is my code:
  --
  --
  
  --
 
  $NowDate = date(m/d/y);
 
  $DBASE = odbc_connect(mno,admin,admin);
  $getnews = odbc_exec($DBASE,
  
  INSERT INTO News
 (NewsDate,NewsTitle,NewsText)
  VALUES
  ('$NowDate','$NewsTitle','$NewsText')
  
  );
 
  Here is the error when using quotes in the NewsText form field:
  --
  --
  
  
  Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax
  error (missing operator) in query expression ''can\'t use quotes!')'.,
  SQL state 37000 in SQLExecDirect in W:\www\clanmno\news_post2.php on
  line 22
 
  Thanks in advance...
 
 
 
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail:
  [EMAIL PROTECTED]
 



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] PLEASE HELP! Problem with ODBC string insert

2001-07-15 Thread Matthew Loff


It would be a hack, but if the data is only going to be used for the
site (e.g. nobody is going to use the data through access) you could
str_replace() the single quote to something else (perhaps an HTML ASCII
representation like #;) before the INSERT/UPDATE, and converting
back when SELECTing.  It's ugly, but it would work...


-Original Message-
From: AKA Hook [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, July 15, 2001 7:21 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] PLEASE HELP! Problem with ODBC string insert


I tried double quotes and many different combinations of single and
double but nothing has worked.

There HAS to be an answer out there! Do certain SQL statements just not
work in PHP / Access? Is this a bug in Access or PHP?

If I can't get this to work then I won't be able to use PHP for this
site! Someone please shed some light on this!

Matthew Loff [EMAIL PROTECTED] wrote in message
001701c10dae$53146280$0100a8c0@bang">news:001701c10dae$53146280$0100a8c0@bang...


 That looks like a valid query to me...  I know this would break SQL92 
 standard, but have you tried enclosing the values in double quotes?  I

 know that's valid with MySQL...

 I don't have any other suggestions... Does anyone else?


 -Original Message-
 From: AKA Hook [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, July 15, 2001 3:56 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] PLEASE HELP! Problem with ODBC string insert


 Here is the echo output.

 UPDATE News SET NewsTitle = 'Text',
 NewsText = 'can\'t use quotes!' WHERE NewsID = 16


 Matthew Loff [EMAIL PROTECTED] wrote in message 
 000e01c10d89$6fa576c0$0100a8c0@bang">news:000e01c10d89$6fa576c0$0100a8c0@bang...
 
  It might help us to see exactly what the query is...
 
  Could you insert an echo statement and let us know what SQL query 
  it's

  producing?
 
  echo 
  INSERT INTO News
 (NewsDate,NewsTitle,NewsText)
  VALUES
  ('$NowDate','$NewsTitle','$NewsText')
  ;
 
 
  -Original Message-
  From: AKA Hook [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, July 15, 2001 1:03 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] PLEASE HELP! Problem with ODBC string insert
 
 
  I am using an Access DBASE and trying to insert text from a form 
  field. When I use quotes in my text the code errors out, otherwise 
  it works fine. I have Magic Quotes turned on which is supposed to 
  fix this problem but IT DOES NOT!
 
  I have posted in several forums but no one has been able to help me!

  Here is my code:
  
  --
  --
  
  --
 
  $NowDate = date(m/d/y);
 
  $DBASE = odbc_connect(mno,admin,admin);
  $getnews = odbc_exec($DBASE,
  
  INSERT INTO News
 (NewsDate,NewsTitle,NewsText)
  VALUES
  ('$NowDate','$NewsTitle','$NewsText')
  
  );
 
  Here is the error when using quotes in the NewsText form field:
  
  --
  --
  
  
  Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax
  error (missing operator) in query expression ''can\'t use
quotes!')'.,
  SQL state 37000 in SQLExecDirect in W:\www\clanmno\news_post2.php on
  line 22
 
  Thanks in advance...
 
 
 
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED] For 
  additional commands, e-mail: [EMAIL PROTECTED] To contact 
  the list administrators, e-mail: [EMAIL PROTECTED]
 



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
[EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] PLEASE HELP !!!

2001-05-22 Thread matthew knight

when you say an error - do you mean any error?
or specific errors? ie., you're not getting it stuck in an infinite loop?
(cpu time flips up to that when you stick in a loop)

or is it all errors?



PHPFAN [EMAIL PROTECTED] wrote in message
9eetk0$92d$[EMAIL PROTECTED]">news:9eetk0$92d$[EMAIL PROTECTED]...
 I am running PHP 4.0.5 on Windows 2000 with SQL server databases.
 If there is an error with my PHP code, my computer becomes very very slow
 and  nothing works. The PHP process is using 99 % of the CPU. So I have to
 restart the computer. This
 happens everytime there is an error in my PHP code. For the work I am
doing,
 I have to use PHP with backend SQL
 Server on Windows Platform.

 Any suggestions will be greatly appreciated.

 Thank you
 PHPFAN



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Please help me with this script...

2001-04-02 Thread Mark Roedel

 -Original Message-
 From: Slider [mailto:[EMAIL PROTECTED]]
 Sent: Monday, April 02, 2001 9:27 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Please help me with this script...
 
 
 Hello,
 
 I've been working on this script all day, but I'm getting the 
 same failure
 report each time:
 
 Warning: Supplied argument is not a valid MySQL result resource in
 c:\program files\apache 
 group\apache\htdocs\motoerit\toon_alles.php on line 23
 
 What could be wrong? This is the code I have:

This usually means there was a problem with your query.  For more info,
including some useable sample code that should help you troubleshoot
exactly what went wrong, see

http://www.php.net/FAQ.php#7.12

---
Mark Roedel ([EMAIL PROTECTED])  ||  "There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full."
 LeTourneau University  ||-- Henry Kissinger


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]