Re: [PHP-DB] Really Dumb Question...

2001-04-11 Thread Darryl Friesen



> How do I create a table within my PHP? Heres what I currently have, but I
> keep getting parse error on the "create" line...

Because create is not a valid PHP command.  You have to assign the create
statement to a string, _then_ pass the string to mysql_query:

$sql = "create table $propTable (
  ID int not null auto_increment primary key,
  TourName tinytext,
  TourTitle tinytext,
  ViewTitle tinytext,
  TourNum tinyint not null,
  Applet tinyint not null,
  Desc text,
  TourPath text,
  SmFile text,
  LgFile text );
";

$result = mysql_query($sql);


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] how do I connect to MSSQL and mySQL with PHP4 and Linux?

2001-03-28 Thread Darryl Friesen

> I see this FreeTDS thing (www.freetds.org), but do I really need that?
> I don't even know what it is really? The 'FAQ' is not very informative for
a
> 'novice'.
> It seems like some extra layer of minutiae that I don't want to deal with.
>
> Isn't there some way to compile PHP "--with-mssql" just like there is
> "--with-mysql"?

No.

> And there are all these built in mssql_connect() etc functions in PHP
> already, how would FreeTDS effect that?

It lets you use them.

There are two ways to talk to an SQL server, ODBC (in which case you'd use
the odbc_* functions) or TDS (using the sybase_* or mssql_* functions).
You'll need support installed on your linux box for at least one of these
protocols.

All the unix based ODBC stuff I've seen also _requires_ software to be
installed on your SQL server.  TDS does not; think of it as the 'native'
protocol spoken by the MS SQL server (and Sybase servers actually).  It's
_way_ easier than ODBC (I never could get ODBC support installed and working
on our Digital Unix machines). FreeTDS is a free, open source implementation
of the TDS protocol.

>I guess I was hoping this would be simple, like mySQL connectivity was...

It's no more work than MySQL.  In order to compile PHP with MySQL support,
you first had to install MySQL.  In order to talk to a Sybase or MS SQL
server, you need to install TDS.

FreeTDS is very easy to install.  You should be able to install FreeTDS and
recompile PHP in under an hour.  The only tricky part is knowing what port
the SQL server listens on (the default is 1433).

Feel free to email me if you need more help.

By the way, I understand there are major issues with SQL2000 server.  In
that case, ODBC might be a better choice.


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"




-- 
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] A question - ($file_exists)

2001-03-27 Thread Darryl Friesen

> Whats wrong with this code?
>
> $img1 = "episodeID_a.jpg";
> $img2 = "episodeID_b.jpg";
> $img3 = "episodeID_c.jpg";

> $img$x="blank.jpg";

That doesn't what you expect.  I think the syntax is the same as Perl:

$var  = "$img$x"; #  $var hold the _name_ of the variable
  #  you want to change
$$var = "blank.jpg";  #  The $$ syntax is used to references the
  #  actual variable

See the section of the manual dealing with variables
(http://www.php.net/manual/en/language.variables.php)


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] Hold that insert!

2001-03-27 Thread Darryl Friesen

> I have the insertRecord function which is supposed to be called only
> when you hit submit. For some reason I'm blanking out on how to do
> this. The function and function call ARE on the same page. I think I
> just need some logic to indicate "stop" and "go".

Every form has a submit button right?  Submit buttons are form elements
(whose value is submitted when the button is clicked), just like any other
form field.  So I have something like this:

   

In my PHP code, I check the value of $submit; if it's empty, I know the form
data hasn't been submitted yet (if it had, $submit would have the value "
Click Here! "), so in that case I display the form.  If it does not have an
empty value, the user has clicked the submit button, so I can go ahead
processing the form data.  Like this:

if ( empty($submit) )
{
### Display the form
}
else
{
### Do some checks to make the the data is OK

### Do the Insert, or whatever else is to be done
}



- Darryl

 ------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] Editing DB entries via form

2001-03-27 Thread Darryl Friesen

> Say a person checks the 1, 5, and 9 check boxes and hits delete.
> How do I know in the myEditNews.php file that those particular boxes
> were checked??  When I figure this out, I will use a loop to delete
> the news items one at a time from the database (unless there is a
> better way).
>
> My understanding of check boxes is that they are not sent from the
> form unless they are checked.

Correct.

> Am I making this hard on myself?

Yes.  There's no need to have all the JavaScript and hidden fields.

   Item 1
   Item 2
   Item 3

Notice the naming convention of the HTML checkbox elements!  It's important
to have the square (array) brackets.  Now, when user clicks the submit
button, your PHP script will have a newsItem array that will contain the
VALUEs from above for all those that were checked. (i.e. an array containing
'Item1' and 'Item3' if #1 and 3 were checked).

Now loop through the newsItem array deleting those records, or create a
single query to delete them all at once (off the top of my head, I _think_
something like "DELETE FROM table WHERE Item='Item1' OR Item='Item3'" will
work)


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] Select where

2001-03-20 Thread Darryl Friesen

> Thanks, I only gave the mySQL but the php scripting is
>
> $deceased = mysql_query(SELECT * FROM members where
> status=\'deceased\'");
>  and later
> while ($myrow = mysql_fetch_row($deceased))
>
> MySQL now says in relation to the *while* line
> Warning: Supplied argument is not a valid MySQL result resource

Yikes!  I hope those are typos, and that you didn't cut and paste that query
from your script.  If you did, then it needs some work.  Try:

$deceased = mysql_query("SELECT * FROM members where status='deceased'");

You need the leading double quote before SELECT, and you don't need to
escape the single quotes.


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] More on strings

2001-03-20 Thread Darryl Friesen

>  $resultp = mysql_query("select Primaryid from primarycodes where Code =
> '".$row['Primaryexpertise']."'") or die (mysql_error());
>
>  $resultp = mysql_query("select Primaryid from primarycodes where Code
like
> '%$row[Primaryexpertise]%'") or die (mysql_error());
>
>  $pcodeid = mysql_fetch_array($resultp) or die("No pcodeid");

Two suggestions.:

First, stick the query into a variable instead of using it directly; that
way you can do some simple debugging (i.e. print the query to the page
instead of posting this email).  Second, take the array variable out of the
double quotes, like you did in the first line.

$sql = "select Primaryid from primarycodes where Code like'%" .
$row[Primaryexpertise] . "%'";
print $sql . "\n";
$resultp = mysql_query($sql) or die (mysql_error());


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"




-- 
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] Re: [PHP] Query - Grouping Results

2001-03-19 Thread Darryl Friesen

> Doesn't seem to work, how would I print that out with PHP?

The results will come back sorted by name, then time.  While processing each
row, you'll need to keep track of when the username changes, something like
this (this is just rough code, not quite valid PHP):

$username = '';
while ($data = fetchrow)
{
if ($username != $data['name'])
{
$username = $data['name'];
print "Logins for " . $username . "\n\n";
}
print $login . "\n";
}

Keep track of the current user.  As you examine each record, check if it's
different than the current one.  If it is, save it as the current username,
and print the login info.  If it's the same, just print the login info.


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] Default port on sybase_connect()

2001-03-15 Thread Darryl Friesen

> In the documentation for sybase_connect() the 'interfaces' file is
> mentioned. Where is this file on php4 for win32, and what is the syntax
for
> defining a server including a specific port?


It's in whatever directory you installed FreeTDS or the Sybase client.  It
should be fairly obvious by looking at the file how to change the port
number.  Also, check out the documentation that came with FreeTDS/Sybase.


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] mysql_fetch_array problem...!

2001-03-05 Thread Darryl Friesen

> How can I refer to one specific row in this query..?
> What I mean is, how can i refer to result row number 4...?
>
> If I only selected rows from one table I could do something like this:
>
> $i = mysql_fetch_array($sql) ;
> echo "$i[4]" ;

Actually, no.  mysql_fetch_array return the _current row_ from the query
(use this function in a loop to process each row of the resulting data).
$i[4] in your case is the fourth field in the current row.

If you really don't want to process the rows in order, look at the
documentation for mysql_data_seek; it can be used to jump around the result
set.


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] jacked up quotes

2001-03-02 Thread Darryl Friesen

> printf ("%s", $row['client'],
$row['client']);
>
>  print "".$row['client']."";


I've always found it easier NOT to use double quotes unless I have to;
avoids all those slashes and makes things easier to follow.  Try:

print '' . $row['client'] .
'';


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] Drop down box

2001-03-01 Thread Darryl Friesen



> The action you want is only available using JavaScript.
>
> You need to submit the form without a submit button.
> The "" tag has the "OnChange" event which is scriptable. You
> can use the JavaScript statement "this.form.submit();" associated
> with the "OnChange" event.
>
> ... ...
> ...

It's a good idea to include the submit button as well, for browers that
don't support javascript, or for those who turn it off.  That way your site
will always work properly.





-- 
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] Resolution detect and redirect

2001-02-27 Thread Darryl Friesen

>>>Why not just create a table that will resize to any resolution?
>>
>> Because I am using different sized images for the different resolutions
as
>> well as other page thingys.
>>
>> And I need the script for other things too.
>>
>> So can anyone help?

Is there anyway to convince you this is a very very bad idea?  Leave the
choice up to the user.

Why?  Sure, my screen resolution is 1024x768, but I never run the browser
full screen (I'd bet 99% of people don't), so forcing me to view a page that
only looks good at 1024x768 when my window size is closer to 800x600 just
annoys me (I've seen a few sites like that; left immediatly even though they
were good sites).

If I have the choice, I'll pick the one I think is closest to my current
window size.  I've seen several sites that do this.  Much better.

Another reason not to do this is all the extra work in maintaining all the
different versions of pages/images etc.  Better to spend the time writing
PHP code. :)


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"





-- 
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] array awry

2001-02-27 Thread Darryl Friesen

> Perhaps I've misunderstood.
>
> I thought this IS a PHP list (see Rolf Hopkins below).

It's a PHP/Database list, not just PHP.  POsts should have something to do
with BOTH.

> Secondly, this list is not only for MySQL questions and issues (see Cal
> Evans below).  It is for all database questions, as we've seen from
> questins concerning other databases.

I think what he was getting at was the question had nothing to do with
databases; it was a question about arrays, and therefore should have only
been asked in php-general.


- Darryl

 ------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] Hide Files

2001-02-19 Thread Darryl Friesen

>  && ($file_name !="*.php")
>
> how come that still displays all the *.php files?

Because that's an exact string match for a file called '*.php' which
probably doesn't exist.  Try some thing like

&& (substr($file_name, -4) != '.php')

That should exclude all files ending in '.php'.


- Darryl

 ------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] Basic MySQL question

2001-02-15 Thread Darryl Friesen

> At someone's advice, I found mysqladmin w/ "whereis mysqladmin" and later
> did ./bin/mysqladmin in the mysql installation dir (which got me a
printout
> of a bunch of commands for use with mysqladmin, but none of them worked),
> but I still can't get anywhere.

Is the mysql server process running?  I assume this is a unix box of some
sort.  Try "ps -ef | grep mysqld".  Get any results?


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] Apache, PHP4, access problem to MS SQL 7.0

2001-02-14 Thread Darryl Friesen

> There should be a file called 'interfaces' in whatever directory you
> installed FreeTDS (our is in /usr/local/freetds).  That file lists all the
> Sybase/MSSQL servers you can connect to.  Ours looks like this:
>
> server1
> query tcp tds4.2 128.233.x.y 1433
> server2
> query tcp tds7.0 128.233.x.y 1433

One more thing I forgot.  The server names are NOT IP names (i.e. gollum,
NOT gollum.usask.ca).  They can be anything, and don't have to relate to
hostnames (although that makes it easier to remember).


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] Apache, PHP4, access problem to MS SQL 7.0

2001-02-14 Thread Darryl Friesen

> There should be a file called 'interfaces' in whatever directory you
> installed FreeTDS (our is in /usr/local/freetds).  That file lists all the
> Sybase/MSSQL servers you can connect to.  Ours looks like this:
>
> server1
> query tcp tds4.2 128.233.x.y 1433
> server2
> query tcp tds7.0 128.233.x.y 1433

One more thing I forgot.  The server names are NOT IP names (i.e. gollum,
NOT gollum.usask.ca).  They can be anything, and don't have to relate to
hostnames (although that makes it easier to remember).


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] Apache, PHP4, access problem to MS SQL 7.0

2001-02-14 Thread Darryl Friesen

> Can anybody help me about my serious problem to connect to MS SQL 7.0. I
> tried to use the freetds-driver but i'm not able to connect with it. They
> said that I must define the Serverconnection in the interfaces-file. I
found
> one in the freetds-directory but i don't know how to write it correct.
I've
> got a Linux-webserver and MS SQL runs on a WinNT4.0-Server.

There should be a file called 'interfaces' in whatever directory you
installed FreeTDS (our is in /usr/local/freetds).  That file lists all the
Sybase/MSSQL servers you can connect to.  Ours looks like this:

server1
query tcp tds4.2 128.233.x.y 1433
server2
query tcp tds7.0 128.233.x.y 1433

(substitute 128.233.x.y for the real IP numbers of your server).

For a 'standard' install of MSSQL server the port number is 1433.  Took me a
while to find that.  If you're using FreeTDS, the third parameter of the
interfaces file can be the version of TDS protocol to use when talking to
that server.

Also, make sure you have the SYBASE environment variable set to the
directory where FreeTDS is installed.

I'd recommend trying sqsh (SQL command line shell for Sybase servers --
works with MSSQL as well) to test the connection.  It assumes a full Sybase
install, so the Makefile took a little tweaking in order to get it to
compile, but once installed it will help you debug the connection problem,
test your queries etc.
Not sure of a download site, but if you search Google you're bound to find
it.

Hope that helps.


- Darryl

 ------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] installing MySQL with PHP4.0.3pl1

2001-02-13 Thread Darryl Friesen

> I'm trying to get MySQL to work with php, however I'm running php on a
WinNT
> box and I was wondering if I needed to install MySQL in a specific
location
> on the hard drive?  The reason I as is that when I try to connect to a
> database I create in MySQL in php it doesn't find any database.  I'm
totally
> lost on this and don't have a clue as what to do.  Any help will be
greatly
> appreciated.

If you pick a directory other than the default, I think you need to create a
file called my.cnf in the root of C: indicating where mysql is.  Mine looks
like this:

[mysqld]
basedir = e:/mysql/


I needed to do this before mysqld would even start.


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] what's a "core" file?

2001-02-07 Thread Darryl Friesen

> ran a few php scripts retrieiving info from mysql database to check /
> test things, and ended up with a file called "core" in the same new
> directory created for this purpose. any one know what a "core" file is?
> or why it's there? the scripts were little, under 10k, but the core file
> is 3mb

That's a tiny one.  :)

When a program dies a horrible and nasty death, it produces a core file
("dumps core").  If you have the knowledge and tools, you can debug what
went wrong using these core files.  (someone will explain it better, I'm
sure)

If your PHP script, or mysql server is dumping core, you've got big problems
that need addressing.


- Darryl

 ------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] installing

2001-02-06 Thread Darryl Friesen

> You
> will also need to have Personal Web Server installed on your workstation.
> Internet Explorer is not setup to run php by itself.  It needs a webserver
> to do it.
>
> If you don't want to use Micrsofts Personal Web Server, you can download
the
> win32 version of Apache at www.apache.org.

I wouldn't bother with PWS.  Apache or Xitami (www.xitami.com) are far
easier to setup.  I've installed PHP under both, with no problems.


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] passing object elements in urls

2001-02-06 Thread Darryl Friesen

> Got a slight problem. I'm attempting to pass a number of variables from
> one form to another. The problem occurs when one of the object elements
> contains more than one word.

[snip]


> Any idea how to pass object elements with spaces in a URL?

Try encoding the spaces as %20 (the hex value for a space).  There's
probably a PHP function to do this for you (and one to do the reverse) -- I
haven't looked.

You could try using a + instead of a space too.


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] insert into mysql

2001-01-29 Thread Darryl Friesen

> > > > $sql = "INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";
> >
> > Another thought:  Are ID and part character data of some sort?  If not
(i.e.
> > if ID is an int) then remove the single quotes.
> >
> A trivial point this, but if you insert values in ' into a mysql int
> column then MySQl still treats it as intended. THey aren' necessary for
> int columns, but it is acceptable to have them there

Thanks for pointing that out Tom.  That's a good bit of info to tuck away
for later.

We've been using MSSQL Server 7 here quite a bit lately, and it isn't nearly
as forgiving.  :(

- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] insert in mysql

2001-01-26 Thread Darryl Friesen

> > if(! mysql_query('$sql'))

> Why the single quotes around $sql.  It's a string so you shouldn't have to
> quote it at all.

It's likely the single quotes that's causing the problems now.  Like perl,
single quotes in PHP are for 'absolute' strings, double quotes for
'interpreted' strings (strings that contain variable references, special
characters like \n etc).

By using single quotes you are passing the string '$sql' to the function.
Use double quotes, or better yet (as Paul suggested) remove the quotes
altogether to pass the _value of the $sql variable_ (i.e. your SQL query) to
the mysql_query function.

The rest looks good; except the lack of line breaks and indenting in your
code, but I tend to be anal about that sort of thing :)


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] insert into mysql

2001-01-25 Thread Darryl Friesen



> It still didn't work.
> just says unable to add part

> > $sql = "INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";

Another thought:  Are ID and part character data of some sort?  If not (i.e.
if ID is an int) then remove the single quotes.


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] insert into mysql

2001-01-25 Thread Darryl Friesen



> It still didn't work.
> just says unable to add part

Remove the @ from @mysql_db_query and it will spit out the SQL error
explaining why the query fails.  That should help for debugging.


- Darryl

 ------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] insert into mysql

2001-01-25 Thread Darryl Friesen

> You're INSERT query is wrong.  Take the ',$db' off the end.
  ^^

Oops.  That's "Your".  Long day.

- Darryl



-- 
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] insert into mysql

2001-01-25 Thread Darryl Friesen


> //--- Add part --
> if($act=="ADD"){
> $sql="INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp'),$db";
> if(! @mysql_db_query("$sql")){
>echo("Unable to add part."); mysql_close($db);exit();} }
> 
> Why does this not work?
> 

You're INSERT query is wrong.  Take the ',$db' off the end.

$sql = "INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] failure notice

2001-01-22 Thread Darryl Friesen

One hates to be rude, but can someone reach over and slap Mike.

Or remove him from the list until he sorts out the mail problems.

- Darryl


-- 
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] Child tables in MySQL

2001-01-19 Thread Darryl Friesen



> How about creating a separate table for each user and a column in the
> main table pointing to these user preference tables

I missed the first part of this thread, so forgive me if I'm missing
something, but that seems like a very bad idea.

What if 10,000 people sign up (for whatever this service is)?  Do you really
want 10,000 tables in your database?  Is it not possible to have a single
table for users (one row per user) with preferences in that same table
(perhaps encoded somehow to save space)?  Or a table for users, one for the
different preference options, and third to join them?


- Darryl

 ------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] SQL not working !

2001-01-18 Thread Darryl Friesen

> select first_name from member where (home_email1 like V) AND
>(home_email2 like '%tvk%')

Sorry; cut and pasted that wrong. I meant:

select first_name from member where (home_email1 like '%tvk%') AND
home_email2 like '%tvk%')


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] SQL not working !

2001-01-18 Thread Darryl Friesen

> select first_name from member where (home_email1 && home_email2)
>like '%tvk%';

I think this needs to be something like:

select first_name from member where (home_email1 like V) AND (home_email2
like '%tvk%')


- Darryl

 ----------
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"




-- 
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-DB] Possible Sybase bug

2001-01-17 Thread Darryl Friesen

Appologies in advance for any duplication, but I wasn't sure which list
would be best to use for this question.

I'm having a problem with PHP 4.04pl1 and Sybase/FreeTDS, but before I open
a bug report I thought I'd check if anyone else is having the same problem.

Server Details: Digital Unix 4.0F, FreeTDS 0.51, Apache 1.3.12 and
PHP/4.0.4pl1 (installed as an Apache module).  Database server is SQl 7.0 on
an NT machine.

In my test PHP script, my connection to the database server seems to get
dropped after an INSERT, UPDATE, or DELETE.  The INSERT/UPDATE/DELETE does
work (the table is modified) but any subsequent queries (SELECT etc) will
fail.

I can't reproduce this problem with sqsh or perl (using DBD::Sybase), so I'm
thinking it's a PHP issue.  I've tried compiling FreeTDS
with --with-tdsver=4.2 and --with-tdsver=7.0; same result.

Is anyone else having this problem?  I'd appreciate any help or suggestions.
I've included my sample PHP script below (The first SELECT works, the INSERT
works, but the second SELECT fails).

If I do file this in the bugs database, should I list it as Sybase-CT
related or MSSQL server related?

Thanx,

- Darryl


\n";
} else {
print "First SELECT failed\n";
}

$query = mssql_query("INSERT INTO Subjects (Code,Subject) VALUES ('test1',
'TEST 1')", $dbh);

$query = mssql_query("SELECT * FROM Subjects", $dbh);
if ($query) {
print "Second SELECT successful\n";
} else {
print "Second SELECT failed\n";
}
?>

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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]