php-general Digest 23 Mar 2003 13:56:11 -0000 Issue 1955
Topics (messages 140724 through 140754):
Re: [PHP-DB] Gathering data from a database
140724 by: L0vCh1Y
Re: how to pass variable for $_GET
140725 by: Leif K-Brooks
140727 by: Nate
Re: regex
140726 by: Leif K-Brooks
140728 by: Nate
140729 by: Nate
140730 by: Leif K-Brooks
140731 by: Nate
Re: PHP and IIS
140732 by: Leo Spalteholz
140733 by: Beauford.2002
SSL
140734 by: Rodney Green
140735 by: Jason Sheets
Re: [php] Re: [PHP] SSL
140736 by: Rodney Green
[php] nomenclature
140737 by: John Taylor-Johnston
140739 by: John Hicks
140740 by: Jason Wong
140743 by: John Taylor-Johnston
more issues with variales within strings
140738 by: Dan Rossi
140741 by: Dan Rossi
140748 by: Ernest E Vogelsinger
[php] Blind?
140742 by: John Taylor-Johnston
140744 by: Tom Rogers
140745 by: John Taylor-Johnston
php & javascript problem
140746 by: Denis L. Menezes
htaccess writable by httpd
140747 by: Dan Rossi
automatic newsletter
140749 by: fr r
140750 by: Dan Rossi
Select DataBase Mysql Problem
140751 by: Miguel Angelo
140752 by: Tom Rogers
140754 by: Miguel Angelo
Ayudaaa
140753 by: Jairo Torres
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
-> Mike,
MD> I have been having this problem for a while now, and I cant figure it out. the
code is:
MD> <?
MD> $host = "localhost";
MD> $uname = "sniper";
MD> $pass = "starcraft";
MD> $database = "sha";
MD> $tablename = "members";
MD> $connect = mysql_connect ($host, $uname, $pass);
MD> $select = "mysql_select_db ($database)";
MD> $query = "SELECT * from $tablename";
MD> $result = mysql_query ($query, $connect);
MD> while ($row = mysql_fetch_array($result))
MD> {
MD> print_r( $row );
MD> echo mysql_error();
MD> }
?>>
MD> mysql has an error on line 19. Line 19 is while ($row =
mysql_fetch_array($result)). What am I doing wrong?
MD> Thanks for your help,
MD> Mike
ensure $result is correct:
<?
$host = "localhost";
$uname = "sniper";
$pass = "starcraft";
$database = "sha";
$tablename = "members";
$connect = mysql_connect ($host, $uname, $pass);
what is that? ;] -> $select = "mysql_select_db ($database)"; # why do u use ""?
$query = "SELECT * from $tablename";
$result = mysql_query ($query, $connect);
while ($row = mysql_fetch_array($result))
{
print_r( $row );
echo mysql_error();
}
?>
Yours L0vCh1Y
--- End Message ---
--- Begin Message ---
http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-gpc
DomIntCom wrote:
ok - found urldecode which is now giving me the following;
\'2003-1-3 00:00:01\' AND \'2003-3-10 23:59:59\'
original string;
'2003-1-3 00:00:01' AND '2003-3-10 23:59:59'
"Domintcom" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
ok - I know how to pass these variables by appending variables to the
link.
however, I'm trying to pass the following string;
'2003-1-1 00:00:01' AND '2003-3-20 23:59:59'
now - when I pass it what I get is the following;
date='2003-2-1%2000:00:01'%20AND%20'2003-3-1%2023:59:59'
it seems what I'm going to have to do is replace %20 with a space, but I'm
unclear of how to do that with php.
thanks,
Jeff
--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt
to decrypt it will be prosecuted to the full extent of the law.
--- End Message ---
--- Begin Message ---
stripslashes("\'2003-1-3 00:00:01\' AND \'2003-3-10 23:59:59\'");
"Domintcom" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> ok - found urldecode which is now giving me the following;
>
> \'2003-1-3 00:00:01\' AND \'2003-3-10 23:59:59\'
>
> original string;
>
> '2003-1-3 00:00:01' AND '2003-3-10 23:59:59'
>
>
> "Domintcom" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > ok - I know how to pass these variables by appending variables to the
> link.
> > however, I'm trying to pass the following string;
> >
> > '2003-1-1 00:00:01' AND '2003-3-20 23:59:59'
> >
> > now - when I pass it what I get is the following;
> >
> > date='2003-2-1%2000:00:01'%20AND%20'2003-3-1%2023:59:59'
> >
> > it seems what I'm going to have to do is replace %20 with a space, but
I'm
> > unclear of how to do that with php.
> >
> > thanks,
> >
> > Jeff
> >
> >
> >
>
>
--- End Message ---
--- Begin Message ---
Try this (entirely untested!):
$final_footer =
preg_replace('%INCLUDE_FILE\\[[^\\]]*\\]%','',$final_footer);
Nate wrote:
hi,
i need to search $final_footer for a string such as
%INCLUDE_FILE[/path/to/file]% (where /path/to/file could be anything) and
delete it from the string. it being %INCLUDE_FILE[/path/to/file]% (not just
/path/to/file)
im new to regexps but im guessing I should use preg_match for this?
Can someone give me a code example?
thanks much
Nate
--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt
to decrypt it will be prosecuted to the full extent of the law.
--- End Message ---
--- Begin Message ---
Thanks! That worked almost. It removed everything except for the 2 %
signs.
How might I remove those as well?
"Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
> Try this (entirely untested!):
> $final_footer =
> preg_replace('%INCLUDE_FILE\\[[^\\]]*\\]%','',$final_footer);
>
> Nate wrote:
>
> >hi,
> >
> >i need to search $final_footer for a string such as
> >%INCLUDE_FILE[/path/to/file]% (where /path/to/file could be anything)
> >and delete it from the string. it being %INCLUDE_FILE[/path/to/file]%
> >(not just
> >/path/to/file)
> >
> >im new to regexps but im guessing I should use preg_match for this?
> >
> >Can someone give me a code example?
> >
> >thanks much
> >Nate
> >
> >
> >
> >
> >
>
> --
> The above message is encrypted with double rot13 encoding. Any
unauthorized attempt to decrypt it will be prosecuted to the full extent
of the law.
>
>
>
--- End Message ---
--- Begin Message ---
Thanks! That worked almost. It removed everything except for the 2 %
signs.
How might I remove those as well?
"Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Try this (entirely untested!):
> $final_footer =
> preg_replace('%INCLUDE_FILE\\[[^\\]]*\\]%','',$final_footer);
>
> Nate wrote:
>
> >hi,
> >
> >i need to search $final_footer for a string such as
> >%INCLUDE_FILE[/path/to/file]% (where /path/to/file could be anything) and
> >delete it from the string. it being %INCLUDE_FILE[/path/to/file]% (not
just
> >/path/to/file)
> >
> >im new to regexps but im guessing I should use preg_match for this?
> >
> >Can someone give me a code example?
> >
> >thanks much
> >Nate
> >
> >
> >
> >
> >
>
> --
> The above message is encrypted with double rot13 encoding. Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>
>
--- End Message ---
--- Begin Message ---
Whoops! Try this:
preg_replace('|%INCLUDE_FILE\\[[^\\]]*\\]%|','',$final_footer);
Nate Sanden wrote:
Thanks! That worked almost. It removed everything except for the 2 %
signs.
How might I remove those as well?
"Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Try this (entirely untested!):
$final_footer =
preg_replace('%INCLUDE_FILE\\[[^\\]]*\\]%','',$final_footer);
Nate wrote:
hi,
i need to search $final_footer for a string such as
%INCLUDE_FILE[/path/to/file]% (where /path/to/file could be anything) and
delete it from the string. it being %INCLUDE_FILE[/path/to/file]% (not
just
/path/to/file)
im new to regexps but im guessing I should use preg_match for this?
Can someone give me a code example?
thanks much
Nate
--
The above message is encrypted with double rot13 encoding. Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt
to decrypt it will be prosecuted to the full extent of the law.
--- End Message ---
--- Begin Message ---
Worked great. Thanks so much.
"Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Whoops! Try this:
>
> preg_replace('|%INCLUDE_FILE\\[[^\\]]*\\]%|','',$final_footer);
>
>
> Nate Sanden wrote:
>
> >Thanks! That worked almost. It removed everything except for the 2 %
> >signs.
> >
> >How might I remove those as well?
> >
> >
> >"Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message
> >news:[EMAIL PROTECTED]
> >
> >
> >>Try this (entirely untested!):
> >>$final_footer =
> >>preg_replace('%INCLUDE_FILE\\[[^\\]]*\\]%','',$final_footer);
> >>
> >>Nate wrote:
> >>
> >>
> >>
> >>>hi,
> >>>
> >>>i need to search $final_footer for a string such as
> >>>%INCLUDE_FILE[/path/to/file]% (where /path/to/file could be anything)
and
> >>>delete it from the string. it being %INCLUDE_FILE[/path/to/file]% (not
> >>>
> >>>
> >just
> >
> >
> >>>/path/to/file)
> >>>
> >>>im new to regexps but im guessing I should use preg_match for this?
> >>>
> >>>Can someone give me a code example?
> >>>
> >>>thanks much
> >>>Nate
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>--
> >>The above message is encrypted with double rot13 encoding. Any
> >>
> >>
> >unauthorized attempt to decrypt it will be prosecuted to the full extent
of
> >the law.
> >
> >
> >>
> >>
> >>
> >
> >
> >
> >
> >
>
> --
> The above message is encrypted with double rot13 encoding. Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>
>
--- End Message ---
--- Begin Message ---
On March 22, 2003 04:03 pm, Beauford.2002 wrote:
> I just installed Win2k server and IIS (need it for a project I am
> doing) and get the following error after installing PHP. All
> permissions are set correctly. This appears to be a common problem
> as a search comes up with hundreds of the same problem - funny
> though - no answers.
>
> Any help is appreciated.
Are you absolutely sure the permissions are all set correctly? I
can't see how this problem could be coming from anything else.
Remember to give the IUSR_YOURMACHINENAME account execute access to
php.exe as well as access to uploadtemp and sessionsdata directories.
Also in IIS enable script execution for your website or virtual
folder.
Leo
--- End Message ---
--- Begin Message ---
I'm an Apache user - I had runscripts on for the main server, but I had a
virtual host which did not - I assumed incorrectly that the virtual would
inherit the other settings. I was wrong.
B.
----- Original Message -----
From: "Burhan Khalid" <[EMAIL PROTECTED]>
To: "Beauford.2002" <[EMAIL PROTECTED]>
Sent: Saturday, March 22, 2003 9:32 PM
Subject: Re: [PHP] PHP and IIS
> Hello Beauford.2002,
>
> Saturday, March 22, 2003, 6:03:38 PM, you wrote:
>
> B2> I just installed Win2k server and IIS (need it for a project I am
doing) and
> B2> get the following error after installing PHP. All permissions are set
> B2> correctly. This appears to be a common problem as a search comes up
with
> B2> hundreds of the same problem - funny though - no answers.
>
> B2> Any help is appreciated.
>
> In the IIS properties -- make sure you have "run scripts" enabled for
> the folder in question.
>
>
>
>
>
> --
> Best regards,
> Burhan
> mailto:[EMAIL PROTECTED]
>
>
>
>
--- End Message ---
--- Begin Message ---
Greetings!
Is there a PHP function that will allow a script to connect to a web server
using SSL?
I would need to post data from a script to a remote server securely. The
remote server has SSL enabled.
Thanks,
Rod
********************************************
CinchHost.com - Web Hosting Made Easier
ASP, PHP, CGI, WEBMAIL, And More
Packages as Low as $9.99 - No Set Up fees
http://www.cinchhost.com/
********************************************
--- End Message ---
--- Begin Message ---
Hello Rodney,
You can use Curl to send post requests, take a look at
http://www.php.net/curl
If you have compiled PHP --with-openssl you can also access https
locations with functions such as file_get_contents.
If Curl is not an option and you have PHP compiled with streams and
--with-openssl you can use streams to post data over SSL, take a look at
Example 2 at http://us2.php.net/manual/en/ref.stream.php.
Jason
Rodney Green wrote:
Greetings!
Is there a PHP function that will allow a script to connect to a web server
using SSL?
I would need to post data from a script to a remote server securely. The
remote server has SSL enabled.
Thanks,
Rod
********************************************
CinchHost.com - Web Hosting Made Easier
ASP, PHP, CGI, WEBMAIL, And More
Packages as Low as $9.99 - No Set Up fees
http://www.cinchhost.com/
********************************************
--- End Message ---
--- Begin Message ---
> You can use Curl to send post requests, take a look at
> http://www.php.net/curl
>
> If you have compiled PHP --with-openssl you can also access https
> locations with functions such as file_get_contents.
>
> If Curl is not an option and you have PHP compiled with streams and
> --with-openssl you can use streams to post data over SSL, take a look at
> Example 2 at http://us2.php.net/manual/en/ref.stream.php.
>
Hi Jason. Thanks for the reply and information. It'll give me a good start
to figuring out the best way to do this. I've put in a support request with
my hosting provider to ask if they have cURL installed. I'm hoping they do
as it will probably make it easier for me.
Thanks,
Rod
********************************************
CinchHost.com - Web Hosting Made Easier
ASP, PHP, CGI, WEBMAIL, And More
Packages as Low as $9.99 - No Set Up fees
http://www.cinchhost.com/
********************************************
--- End Message ---
--- Begin Message ---
Hi,
I'm writing an academic paper detailing how my bibliographic database works.
$myinput = mysql_query($sql) or die(print "<font color=red>".mysql_error()."</font>");
while ($mydata = mysql_fetch_object($myinput))
{
}
What is the usual, normal, standard nomenclature for $myinput and $mydata? How do
people "usually" declare/name/type $myinput and $mydata?, usually speaking? I want to
pick something "normal" they might encounter in their travels at www.php.net etc.
Thanks,
John
compcanlit.ca
--- End Message ---
--- Begin Message ---
$result = mysql_query($sql) ;
^
while ($rec = mysql_fetch_object($results))
^
On Saturday 22 March 2003 11:56 pm, you wrote:
> Hi,
> I'm writing an academic paper detailing how my
> bibliographic database works.
>
> $myinput = mysql_query($sql) or die(print "<font
> color=red>".mysql_error()."</font>");
>
> while ($mydata = mysql_fetch_object($myinput))
> {
> }
>
> What is the usual, normal, standard nomenclature for
> $myinput and $mydata? How do people "usually"
> declare/name/type $myinput and $mydata?, usually
> speaking? I want to pick something "normal" they might
> encounter in their travels at www.php.net etc.
>
> Thanks,
> John
> compcanlit.ca
--- End Message ---
--- Begin Message ---
On Sunday 23 March 2003 13:13, John Hicks wrote:
> $result = mysql_query($sql) ;
> ^
> while ($rec = mysql_fetch_object($results))
> ^
I think $row is more commonly used than $rec. And you have an extra 's' on the
second $result.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
broad-mindedness, n:
The result of flattening high-mindedness out.
*/
--- End Message ---
--- Begin Message ---
Thanks jason, john.
http://www.php.net/manual/en/function.mysql-fetch-object.php
$row and $result
Jason Wong wrote:
> On Sunday 23 March 2003 13:13, John Hicks wrote:
> > $result = mysql_query($sql) ;
> > ^
> > while ($rec = mysql_fetch_object($results))
> > ^
>
> I think $row is more commonly used than $rec. And you have an extra 's' on the
> second $result.
--- End Message ---
--- Begin Message ---
hi guys , i am sure this worked on an earlier version of php,
'NOT_ALLOWED_EXTENSION' => "Not Allowed File Extension, the following
filetypes are allowed : ($this->type)\n", this is inside an array
then i used to do
$this->extract_filetypes($this->imgtypes);
$this->error_codes[NOT_ALLOWED_EXTENSION];
where extract filetypes returned $this->type , is there a way to do this now
?
--- End Message ---
--- Begin Message ---
never mind this is the only way i can probaly do this
'NOT_ALLOWED_EXTENSION' => "Not Allowed File Extension, the following
filetypes are allowed : (".$_SESSION['ext_type'].")
-----Original Message-----
From: Dan Rossi [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 23, 2003 2:56 PM
To: Php-General
Subject: [PHP] more issues with variales within strings
hi guys , i am sure this worked on an earlier version of php,
'NOT_ALLOWED_EXTENSION' => "Not Allowed File Extension, the following
filetypes are allowed : ($this->type)\n", this is inside an array
then i used to do
$this->extract_filetypes($this->imgtypes);
$this->error_codes[NOT_ALLOWED_EXTENSION];
where extract filetypes returned $this->type , is there a way to do this now
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
At 04:55 23.03.2003, Dan Rossi said:
--------------------[snip]--------------------
>hi guys , i am sure this worked on an earlier version of php,
>
>
>'NOT_ALLOWED_EXTENSION' => "Not Allowed File Extension, the following
>filetypes are allowed : ($this->type)\n", this is inside an array
>
>then i used to do
>
>$this->extract_filetypes($this->imgtypes);
>$this->error_codes[NOT_ALLOWED_EXTENSION];
>
--------------------[snip]--------------------
If you put $this->type in curly quotes it will work:
$emsg = array('NOT_ALLOWED_EXTENSION' => "Not Allowed File Extension, the
following filetypes are allowed : ({$this->type})\n",
);
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
--- End Message ---
--- Begin Message ---
I'm blind or tired or both. Anyone see anything wrong with:
$sql = 'SELECT * FROM '.$table.' WHERE MATCH
(author,title,book,journal,volumenumber,issuenumber,placeofpublication,publisher,year,pages)
AGAINST (\''.stripslashes($searchenquiry).'\' IN BOOLEAN MODE) ORDER BY id asc;';
I've tried looking at it in a .phps but don't see it.
--- End Message ---
--- Begin Message ---
Hi,
Sunday, March 23, 2003, 4:25:29 PM, you wrote:
JTJ> I'm blind or tired or both. Anyone see anything wrong with:
JTJ> $sql = 'SELECT * FROM '.$table.' WHERE MATCH
JTJ>
(author,title,book,journal,volumenumber,issuenumber,placeofpublication,publisher,year,pages)
JTJ> AGAINST (\''.stripslashes($searchenquiry).'\' IN BOOLEAN MODE) ORDER BY id asc;';
JTJ> I've tried looking at it in a .phps but don't see it.
Is that an extra ; near the end ;';
--
regards,
Tom
--- End Message ---
--- Begin Message ---
Yeah, but it works it you pass it into MySQl. Obligatory I think.
I found my problem 10 lines up. A missing ; but singled out that line - just to
confuse me.
Sorry, it wasn't that after all. Thanks,
John
Tom Rogers wrote:
> Hi,
>
> Sunday, March 23, 2003, 4:25:29 PM, you wrote:
> JTJ> I'm blind or tired or both. Anyone see anything wrong with:
>
> JTJ> $sql = 'SELECT * FROM '.$table.' WHERE MATCH
> JTJ>
> (author,title,book,journal,volumenumber,issuenumber,placeofpublication,publisher,year,pages)
> JTJ> AGAINST (\''.stripslashes($searchenquiry).'\' IN BOOLEAN MODE) ORDER BY id
> asc;';
>
> JTJ> I've tried looking at it in a .phps but don't see it.
>
> Is that an extra ; near the end ;';
--- End Message ---
--- Begin Message ---
Hello friends.
I need to control the users viewing from one location so that when I change the URL
string in a text file, the viewers page which has a timer automatically reads the URL
on the text pages and goes to that page.
Updating the textfile is ok. But below is the script onthe page which I want to reload
every 10 seconds and display the name of the new page and go there.
There are two problems, when the page reloads, the PHP script that gets the new URL
from the text file does not seem to run.
Can someone please tell me where I am wrong?
Thanks very much.
Denis
<?php
$fo=fopen("currenttext.txt","r+");
$currenturl=fgets($fo,128);
$currenturl="\"".$currenturl."\"";
Print $currenturl;
Print"<form name=\"frmurl\">";
Print"<input type=\"hidden\" name=\"currenturl\" size=\"4\" value=$currenturl >";
Print "<input type=\"text\" name=\"clock\" size=\"4\">";
Print"<form>";
fclose($fo);
?>
<html>
<head>
<SCRIPT LANGUAGE="Javascript">
<!--
var x = 10
var y = 1
var url= document.frmurl.currenturl.value;
function startClock(){
x = x-y
document.frmurl.clock.value = x
setTimeout("startClock()", 1000)
if(x==0){
location=url
//window.location.reload()
//document.frmurl.clock.value = 10
//x=10;
}
}
//-->
</script>
--- End Message ---
--- Begin Message ---
is this a dangerous feature ?
--- End Message ---
--- Begin Message ---
hi guys..i wanna make an automatic newsleter; meanings there is no page to force the
newsletter to be sent..i wanna server to handle this....
any ideas???
---------------------------------
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
--- End Message ---
--- Begin Message ---
cron job it , and execute the script using the command line php
-----Original Message-----
From: fr r [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 23, 2003 9:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP] automatic newsletter
hi guys..i wanna make an automatic newsleter; meanings there is no page to
force the newsletter to be sent..i wanna server to handle this....
any ideas???
---------------------------------
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
--- End Message ---
--- Begin Message ---
Hi everyone,
FIRST THANKX FOR ANY HELP !!
and THANKX FOR READING :)
I'm a reall newbie on PHP and i'm build a php app to connect into a mysql
database.. but i cannot select the database
i have build the database, and created a user
with :
create database mydatabase;
use mydatabase;
create tb_users ( userid varchar(20), userpassword varchar(20 );
grant select, update, insert, delete on mydatabase.* to [EMAIL PROTECTED]
IDENTIFIED BY "mypassword";
then flush priveliges...
I tested the user on mysql and it work correcly for my the pretended database
NOTES:
O.S. Linux
Mysql : compiled the most recent stable 4.0.12
Php was compiled by SuSe on SuSe 8.0
Php is connected into mysql via socks (configured on /etc/php.ini)
to test the set up i have used the php.net manual example to connect into the
mysql database i manage to connect into mysql but i cannot select the database
can this be my mistake or can it be a software problem ?
here is the php programa
<?php
$DB_HOST = "localhost";
$DB_USER = "myuser";
$DB_PASSWORD = "mypassword";
$DB_NAME = "mydatabase";
/* Connecting, selecting database */
$link = mysql_connect("$DB_HOST", "$DB_USER", "$DB_PASSWORD") or
die("Could not connect<br>");
print "Connected successfully<br>";
mysql_select_db("$DB_NAME", $link) or die("Could not select
database<br>");
/* Performing SQL query */
$query = "SELECT * FROM tb_users";
$result = mysql_query($query) or die("Query failed<br>");
/* Printing results in HTML */
print "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
print "\t<tr>\n";
foreach ($line as $col_value) {
print "\t\t<td>$col_value</td>\n";
}
print "\t</tr>\n";
}
print "</table>\n";
/* Free resultset */
mysql_free_result($result);
/* Closing connection */
mysql_close($link);
?>
Stay Happy
Miguel Angelo
------- End of Forwarded Message -------
--- End Message ---
--- Begin Message ---
Hi,
Sunday, March 23, 2003, 1:26:04 PM, you wrote:
MA> Hi everyone,
MA> FIRST THANKX FOR ANY HELP !!
MA> and THANKX FOR READING :)
MA> I'm a reall newbie on PHP and i'm build a php app to connect into a mysql
MA> database.. but i cannot select the database
MA> i have build the database, and created a user
MA> with :
MA> create database mydatabase;
MA> use mydatabase;
MA> create tb_users ( userid varchar(20), userpassword varchar(20 );
MA> grant select, update, insert, delete on mydatabase.* to [EMAIL PROTECTED]
MA> IDENTIFIED BY "mypassword";
MA> then flush priveliges...
MA> I tested the user on mysql and it work correcly for my the pretended database
MA> NOTES:
MA> O.S. Linux
MA> Mysql : compiled the most recent stable 4.0.12
MA> Php was compiled by SuSe on SuSe 8.0
MA> Php is connected into mysql via socks (configured on /etc/php.ini)
MA> to test the set up i have used the php.net manual example to connect into the
MA> mysql database i manage to connect into mysql but i cannot select the database
MA> can this be my mistake or can it be a software problem ?
MA> here is the php programa
MA> <?php
MA> $DB_HOST = "localhost";
MA> $DB_USER = "myuser";
MA> $DB_PASSWORD = "mypassword";
MA> $DB_NAME = "mydatabase";
MA> /* Connecting, selecting database */
MA> $link = mysql_connect("$DB_HOST", "$DB_USER", "$DB_PASSWORD") or
MA> die("Could not connect<br>");
MA> print "Connected successfully<br>";
MA> mysql_select_db("$DB_NAME", $link) or die("Could not select
MA> database<br>");
MA> /* Performing SQL query */
MA> $query = "SELECT * FROM tb_users";
MA> $result = mysql_query($query) or die("Query failed<br>");
MA> /* Printing results in HTML */
MA> print "<table>\n";
MA> while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
MA> print "\t<tr>\n";
MA> foreach ($line as $col_value) {
MA> print "\t\t<td>$col_value</td>\n";
MA> }
MA> print "\t</tr>\n";
MA> }
MA> print "</table>\n";
MA> /* Free resultset */
MA> mysql_free_result($result);
MA> /* Closing connection */
MA> mysql_close($link);
?>>
MA> Stay Happy
MA> Miguel Angelo
MA> ------- End of Forwarded Message -------
Add a call to mysql_error() to find out what mysql does not like.
mysql_select_db("$DB_NAME", $link) or die("Could not select database:
".mysql_error()."<br>");
--
regards,
Tom
--- End Message ---
--- Begin Message ---
Thankx a million Tom,
I used .mysql_error() and i found it right away.
Actualy i have a config.php file with the mysql user information and i was
forgeting to do a include("config.php"); before i used mysql.
Really stupid error.
Thankx again.
Miguel Angelo
> Hi,
>
> Sunday, March 23, 2003, 1:26:04 PM, you wrote:
> MA> Hi everyone,
>
> MA> FIRST THANKX FOR ANY HELP !!
> MA> and THANKX FOR READING :)
>
> MA> I'm a reall newbie on PHP and i'm build a php app to connect
> into a mysql MA> database.. but i cannot select the database
>
> MA> i have build the database, and created a user
> MA> with :
>
> MA> create database mydatabase;
> MA> use mydatabase;
> MA> create tb_users ( userid varchar(20), userpassword varchar(20 );
>
> MA> grant select, update, insert, delete on mydatabase.* to [EMAIL PROTECTED]
> MA> IDENTIFIED BY "mypassword";
>
> MA> then flush priveliges...
> MA> I tested the user on mysql and it work correcly for my the
> pretended database
>
> MA> NOTES:
> MA> O.S. Linux
> MA> Mysql : compiled the most recent stable 4.0.12
> MA> Php was compiled by SuSe on SuSe 8.0
> MA> Php is connected into mysql via socks (configured on /etc/php.ini)
>
> MA> to test the set up i have used the php.net manual example to
> connect into the MA> mysql database i manage to connect into mysql
> but i cannot select the database MA> can this be my mistake or can
> it be a software problem ?
>
> MA> here is the php programa
>
> MA> <?php
> MA> $DB_HOST = "localhost";
> MA> $DB_USER = "myuser";
> MA> $DB_PASSWORD = "mypassword";
> MA> $DB_NAME = "mydatabase";
>
> MA> /* Connecting, selecting database */
> MA> $link = mysql_connect("$DB_HOST", "$DB_USER", "$DB_PASSWORD")
> or MA> die("Could not connect<br>"); MA> print "Connected
successfully<br>";
> MA> mysql_select_db("$DB_NAME", $link) or die("Could not select
> MA> database<br>");
>
> MA> /* Performing SQL query */
> MA> $query = "SELECT * FROM tb_users";
> MA> $result = mysql_query($query) or die("Query failed<br>");
>
> MA> /* Printing results in HTML */
> MA> print "<table>\n";
> MA> while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
> MA> print "\t<tr>\n";
> MA> foreach ($line as $col_value) {
> MA> print "\t\t<td>$col_value</td>\n";
> MA> }
> MA> print "\t</tr>\n";
> MA> }
> MA> print "</table>\n";
>
> MA> /* Free resultset */
> MA> mysql_free_result($result);
>
> MA> /* Closing connection */
> MA> mysql_close($link);
> ?>>
>
> MA> Stay Happy
> MA> Miguel Angelo
> MA> ------- End of Forwarded Message -------
>
> Add a call to mysql_error() to find out what mysql does not like.
>
> mysql_select_db("$DB_NAME", $link) or die("Could not select
> database: ".mysql_error()."<br>");
>
> --
> regards,
> Tom
--- End Message ---
--- Begin Message ---
Cuando ejecuto el comando make me genera el siguiente error:
Zend/zend_execute.lo: file not recognized:File trycated
Collect2: ld returned 1 exit status
make ***[libphp4.la] Error 1
Esto ocurre siempre que ejecuto ./configure con la pocion.
--with-apxs=/usr/sbin/apxs
La version de PHP es.: PHP 4.3.0 y Apache 1.3
Gracias
Jairo Torres
Analista de Soporte
Tecnólogo en Sistemas
--- End Message ---