[PHP] jpgs into database

2005-07-17 Thread George B
is it possible to put in a jpg file into a database? I am trying to make 
like a catalong and have all the files (including pics) and everyone can 
see.

is this possible?

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



[PHP] Re: Tracking a mobile phone

2005-07-18 Thread George B

Ethilien wrote:
I think that would require tapping the cellphone network, which I doubt 
they would let you do since it be a major violation of privacy, because 
you could track the general location of anyone on their network.


Thomas wrote:


Hi there,

 

I was wondering if anybody has attempted to track a mobile phone 
through a
country. I know that this is usually more a case for the FBI . a 
friend of

mine is going on a 4 month bike tour and I would like to 'track' him for
locations. I thought of an sms receiving system, but if could do any 
other

way would be great.

 


Any ideas?

 


Thomas


There was a way to do this... But it wasnt with cellphones... They have 
a tutorial thing on slashdot


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



[PHP] Re: jpgs into database

2005-07-18 Thread George B

Matthew Weier O'Phinney wrote:

* Jasper Bryant-Greene <[EMAIL PROTECTED]> :


George B wrote:

is it possible to put in a jpg file into a database? I am trying to make 
like a catalong and have all the files (including pics) and everyone can 
see.

is this possible?


Sure -- if you're using a MySQL database, just use a BLOB field and put 
the data in as you would a string of text.



Be aware of your storage requirements, however. There are several BLOB
types -- TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB -- so make certain you
choose the one that exceeds the maximum file size you expect to place in
the DB.

Additionally, there are performance hits to storing images in a
database. Another approach that is widely used is to store the images on
the filesystem, and then image *details* -- location, size, caption,
photographer, etc. -- in the database. This is typically faster, and
will reduce the number of DB calls.


yeah that probably is a better idea :)

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



[PHP] change letter to all caps

2005-07-18 Thread George B
Lets say I have a form. And when user types in the form and clicks go, 
it shows output.

but.
lets say the person type in
monday
But I want the php code to change it too
MONDAY
how do I do that?
Thanks!

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



[PHP] syntax error, unexpected T_STRING

2005-07-18 Thread George B

I am trying to connect to a datbase:

"
mysql_select_db ('database')
or die ("couldnt connect to databse")
"
What is wrong here?
This is the error:

Parse error: syntax error, unexpected T_STRING in file name on line 12

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



[PHP] Re: syntax error, unexpected T_STRING

2005-07-18 Thread George B

George B wrote:

I am trying to connect to a datbase:

"
mysql_select_db ('database')
or die ("couldnt connect to databse")
"
What is wrong here?
This is the error:

Parse error: syntax error, unexpected T_STRING in file name on line 12

this code works though

$db = mysql_connect("localhost", "myaccount", "mypass") or die("Could 
not connect.");

if(!$db)
die("no db");
if(!mysql_select_db("database",$db))
die("No database selected.");

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



Re: [PHP] syntax error, unexpected T_STRING

2005-07-18 Thread George B

Jim Moseby wrote:

I am trying to connect to a datbase:

"
mysql_select_db ('database')
or die ("couldnt connect to databse")
"
What is wrong here?
This is the error:

Parse error: syntax error, unexpected T_STRING in file name on line 12

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





Extra spaces, and no semicolon? 
try:


mysql_select_db('database') or die("couldnt connect to databse");

JM

Thanks JM!
It was another one of my usual mistakes :P
Forgot the semicolon. I don't underestand why you have to put in so many 
semicolons... Hmm.. Is it a thing from C or something?


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



[PHP] show a field in php file

2005-07-18 Thread George B

Hey guys how would i show a filed from a MySQL database in a php file?
Isnt it this?
SELECT * FROM `user`
But that dosent work because it comes out blank :-\
And I already am connected to the database
Code:

mysql_connect ('localhost','myaccount','mypass')
or die ("could not connect to server");
mysql_select_db ('database')
or die ("could not connect to database");

$query = "SELECT *
FROM `user`
LIMIT 0 , 30";
mysql_query($query);

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



Re: [PHP] show a field in php file

2005-07-18 Thread George B

Jochem Maas wrote:

John Nichel wrote:


George B wrote:


http://us2.php.net/manual/en/index.php



:-) anyone care for a php mysql extension:

mysql_do_xml_http_request_bound_richdatagrid([string] query);

george if you want to keep asking questions on NRBS**
then you'll need to change email addrs + name :-)

** from Johns 'non-researched basic stuff' I like the way
the BS comes out ... :-P
what is it wrong to ask questions on a php general mailing list where I 
know there are a bunch of people that can help? I do have a php book 
But it dosent show. Why can other people ask questions but I cant?


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



[PHP] My Project

2005-07-19 Thread George B
Hey guys! This is gona be one of my last questions (hopefully) But here 
I will include all the info about my new project.
It is going to be like a RPG Game written in PHP. There is going to be a 
store where you could buy weapons etc... The thing I want to ask you 
guys is this. Lets say There is a knife i want to buy. It costs 10 
points. And I have 100 points. How would I make it so when I click BUY!! 
My money automaticaly subtracts from 100 to 90. How do I do that?


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



Re: [PHP] My Project

2005-07-19 Thread George B

Shaw, Chris - Accenture wrote:

Taxi for one..

-Original Message-
From: George B [mailto:[EMAIL PROTECTED]
Sent: 19 July 2005 17:39
To: php-general@lists.php.net
Subject: [PHP] My Project


Hey guys! This is gona be one of my last questions (hopefully) But here

I will include all the info about my new project.
It is going to be like a RPG Game written in PHP. There is going to be a

store where you could buy weapons etc... The thing I want to ask you

guys is this. Lets say There is a knife i want to buy. It costs 10

points. And I have 100 points. How would I make it so when I click BUY!!

My money automaticaly subtracts from 100 to 90. How do I do that?

--

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







This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*

taxi? Whats that mean?

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



Re: [PHP] My Project

2005-07-19 Thread George B

Paul Waring wrote:

On Tue, Jul 19, 2005 at 09:39:21AM -0700, George B wrote:

And I have 100 points. How would I make it so when I click BUY!! 
My money automaticaly subtracts from 100 to 90. How do I do that?



Where is your money being stored? In a database? A text file? A cookie?
Do you want the "buy" link to work on the client side using Javascript
or AJAX or have it submit to a PHP script?

Paul

My money is being stored in a database. And I want everythign to be in 
PHP, no java script. And the BUY!! Button is a input button from a form. :)


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



Re: [PHP] My Project

2005-07-19 Thread George B

Paul Waring wrote:

On Tue, Jul 19, 2005 at 09:50:06AM -0700, George B wrote:

My money is being stored in a database. And I want everythign to be in 
PHP, no java script. And the BUY!! Button is a input button from a form. :)



Well in that case you probably want something like this (after you've
checked to see whether the user is logged in etc):

$sql = "UPDATE users SET money = money - 10 WHERE id = " .
$_SESSION['user_id'];

assuming of course that you have a table called users where the money
for each one is stored and you're keeping the user_id in the $_SESSION
superglobal.

It's a bit difficult to help further without a bit more information. :)

Paul

well what kind more information do you want to know? I can provide you 
with all the info.

By the way. Here is my table.

CREATE TABLE `b_users` (
  `userID` bigint(21) NOT NULL auto_increment,
  `username` varchar(60) NOT NULL default '',
  `password` varchar(255) NOT NULL default '',
  `status` int(20) NOT NULL default '0',
  `posts` bigint(20) NOT NULL default '0',
  `email` varchar(255) NOT NULL default '',
  `validated` int(11) NOT NULL default '0',
  `keynode` bigint(21) NOT NULL default '0',
  `sig` tinytext NOT NULL,
  `banned` varchar(255) NOT NULL default 'no',
  `rank` varchar(255) NOT NULL default '0',
  `usepm` int(11) NOT NULL default '1',
  `AIM` varchar(50) NOT NULL default '',
  `ICQ` varchar(50) NOT NULL default '',
  `location` varchar(255) NOT NULL default '',
  `showprofile` smallint(6) NOT NULL default '1',
  `lastposttime` bigint(20) NOT NULL default '0',
  `tsgone` bigint(20) NOT NULL default '0',
  `oldtime` bigint(20) NOT NULL default '0',
  `avatar` varchar(255) NOT NULL default '',
  `photo` varchar(255) NOT NULL default '',
  `rating` bigint(255) NOT NULL default '0',
  `totalvotes` bigint(20) NOT NULL default '0',
  `votedfor` longtext NOT NULL,
  `rps` int(11) NOT NULL default '1',
  `rpsscore` bigint(20) NOT NULL default '0',
  `lasttime` bigint(20) NOT NULL default '0',
  PRIMARY KEY  (`userID`)
) TYPE=MyISAM AUTO_INCREMENT=6 ;

:)

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



[PHP] What is this?

2005-07-19 Thread George B

How is this possibly not working?

$money = $_GET ['money'];
$money = $money -3
echo $money;

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



[PHP] Re: What is this?

2005-07-19 Thread George B

George B wrote:

How is this possibly not working?

$money = $_GET ['money'];
$money = $money -3
echo $money;

oops nvm i forgot the ; on like 2 :D

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



Re: [PHP] My Project

2005-07-19 Thread George B

Jay Blanchard wrote:

[snip]
$money -= 10;

saves some chars ;)
[/snip]

This actually requires two trips to the database, once to get $money and
once to update $money. Do it in the query instead...once.

$sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

saves lots of characters ;)

Hey, Look I made a new database just for this money testing stuff.
This is the table:

CREATE TABLE `money` (
  `money` varchar(255) NOT NULL default ''
) TYPE=MyISAM;

Now, I use this code

$sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

And it should work, And it gives no error but it is not writing anything 
into the database.


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



[PHP] Write from form to DB

2005-08-03 Thread George B

Ok, I got this far.

include("config.php");
$username = $_GET['name'];
$password = $_GET['pword'];
echo "Username = " . $username . "";
echo "Password = " . $password . "";
$query = "INSERT INTO user (name,password) VALUES ($username","$password")
$result = mysql_query($query)


config is just all the info to connect to server. i have to forms. name 
which is a for for entering username, and pword for entering password. I 
 would like it so that when I enter the info for the forms, it puts all 
the data that I entered into a database. In this case I THOUGHT this


$query = "INSERT INTO user (name,password) VALUES ($username","$password")

would do the job but, it dosent. It gives a


Parse error: syntax error, unexpected T_VARIABLE in C:\Program 
Files\Apache Group\Apache2\htdocs\php\login\registration_action.php on 
line 15


How do I fix this, and make it send the data from the form, into the 
database?


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



Re: [PHP] Write from form to DB

2005-08-03 Thread George B

Jay Blanchard wrote:

[snip]
$query = "INSERT INTO user (name,password) VALUES
($username","$password")

would do the job but, it dosent. It gives a

Parse error: syntax error, unexpected T_VARIABLE in C:\Program 
Files\Apache Group\Apache2\htdocs\php\login\registration_action.php on 
line 15

[/snip]

$query = "INSERT INTO user (name,password) VALUES
("'.$username.'","'.$password.'") ";

Try that... should work. your query syntax is mangled.


Nope, now it gives


Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in 
C:\Program Files\Apache 
Group\Apache2\htdocs\php\login\registration_action.php on line 15


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



Re: [PHP] Write from form to DB

2005-08-03 Thread George B

Jim Moseby wrote:

[snip]


$query = "INSERT INTO user (name,password) VALUES
("'.$username.'","'.$password.'") ";

Try that... should work. your query syntax is mangled.



Backwards on your quotes Jay.  Go home and get some sleep. ;)
[/snip]

Damn these corporate mergers!

Corrected query

$query = "INSERT INTO user (name,password) VALUES
('".$username."','".$password."') ";


Why not:

$query = "INSERT INTO user (name,password) VALUES>
('$username','$password')";




Or:

$query = "INSERT INTO user (name,password) VALUES('$username','$password')";

...rather.

JM


It does not seem to be putting anything into the DB. Gives no errors, 
but I check PHP My Admin, and there is nothing in the users and 
passwords field. I think something isnt working hmmm


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



Re: [PHP] Write from form to DB

2005-08-03 Thread George B

Jay Blanchard wrote:

[snip]
It does not seem to be putting anything into the DB. Gives no errors, 
but I check PHP My Admin, and there is nothing in the users and 
passwords field. I think something isnt working hmmm

[/snip]

There is a brilliant statement if there ever was one! ROFLMMFAO!

Does the mysql user you are using for this little drill have permission
to do inserts?


Yeah I am using "root" which has all permissions

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



Re: [PHP] Write from form to DB

2005-08-03 Thread George B

Jay Blanchard wrote:

[snip]
Yeah I am using "root" which has all permissions
[/snip]

Are you sure? Did you specifically GRANT ALL to root? When you did, did
you flush the permissions? BTW, using root is a Bad Idead[tm].
[/snip]

Also, check the mysql error log

Never mind guys! I got it working!

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



Re: [PHP] Write from form to DB

2005-08-03 Thread George B

Jay Blanchard wrote:

[snip]
Yeah I am using "root" which has all permissions
[/snip]

Are you sure? Did you specifically GRANT ALL to root? When you did, did
you flush the permissions? BTW, using root is a Bad Idead[tm].
[/snip]

Also, check the mysql error log


Thanks for all the help guys. It all worked out! The problem was that 
the table in the database was misspelled so it was not going in. It was 
my stupid fault again :-P


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



[PHP] Message check then post

2005-08-03 Thread George B
I am coding a message board. I am about done. I have all the forms 
needed for the message. So it all works out. The user types in his name, 
 message title, and the message itself. Then clicks submit. The Submit 
button takes him to the message check. The message check shows all the 
stuff the user entered. Then it has "echo" which says 'Is this correct'? 
And then there is a button. "Yes" When the user clicks yes it goes to 
another PHP file which runs the SQL query to put in the entereddata into 
the database
$query = "INSERT INTO forum (user,name,message) VALUES 
('$username','$name','$message')";

$result = mysql_query($query);

But see, the problem is that it is entering blanks into the DB. I think 
that is because the $username $name and $message are in the other file? 
I have no idea how to by-pass this problem. What should I do?


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



[PHP] frame help!

2005-08-12 Thread George B
I made a left frame, then made the three pages, and all the frames show 
fine. But this is not my problem! I made a "leftpane" which has code to 
check if user exists (its for a login script). In the code for the login 
FORM I set it to go directly to the "userpane" file. It works fine! It 
recognizes me and all, says I am logged in. But if I set the Login FOrm 
to the main frame file (which shows the 2 frames) it says wrong user and 
password. What do I do to make this work?!?!?!


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



[PHP] Re: frame help!

2005-08-12 Thread George B

George B wrote:
I made a left frame, then made the three pages, and all the frames show 
fine. But this is not my problem! I made a "leftpane" which has code to 
check if user exists (its for a login script). In the code for the login 
FORM I set it to go directly to the "userpane" file. It works fine! It 
recognizes me and all, says I am logged in. But if I set the Login FOrm 
to the main frame file (which shows the 2 frames) it says wrong user and 
password. What do I do to make this work?!?!?!

Well can anyone help? :( :( I really need to know how to do this :(

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



[PHP] mail()

2005-08-17 Thread George B
Warning: mail() [function.mail]: Failed to connect to mailserver at 
"localhost" port 25, verify your "SMTP" and "smtp_port" setting in 
php.ini or use ini_set()


I checked php.ini and everything is open

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
sendmail_from = [EMAIL PROTECTED]

SO why does it not work?

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



Re: [PHP] mail()

2005-08-17 Thread George B

John Nichel wrote:

George B wrote:

Warning: mail() [function.mail]: Failed to connect to mailserver at 
"localhost" port 25, verify your "SMTP" and "smtp_port" setting in 
php.ini or use ini_set()


I checked php.ini and everything is open

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
sendmail_from = [EMAIL PROTECTED]

SO why does it not work?



Do you have a MTA running on localhost?


No,whats an MTA?

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



Re: [PHP] mail()

2005-08-17 Thread George B

André Medeiros wrote:

Do you have a mail server running?
No, how do I get a mail server running? And does it allow me to receive 
e-mails, or only send?


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



Re: [PHP] mail()

2005-08-17 Thread George B

John Nichel wrote:

Jordan Miller wrote:


Did you install sendmail?



No sendmail for Windows.  He either has to have a Microsoft MTA running 
on localhost, or use an upstream SMTP account.



There is no "Microsoft MTA", I searched google couldnt find anything.
so.
Anyway, im screwed and I cant send mail.
I have a program B1Gmail and its like online mail, but it dosent work 
because I dont have a mail server and Im using windows. So I cant do 
anything about it right?


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



Re: [PHP] mail()

2005-08-17 Thread George B

Shaw, Chris - Accenture wrote:

Can you send to a smtp server provided by your isp?

-Original Message-
From: George B [mailto:[EMAIL PROTECTED]
Sent: 17 August 2005 18:11
To: php-general@lists.php.net
Subject: Re: [PHP] mail()


*

This e-mail has been received by the Revenue Internet e-mail service.

*

John Nichel wrote:


Jordan Miller wrote:





Did you install sendmail?






No sendmail for Windows.  He either has to have a Microsoft MTA running




on localhost, or use an upstream SMTP account.




There is no "Microsoft MTA", I searched google couldnt find anything.
so.
Anyway, im screwed and I cant send mail.
I have a program B1Gmail and its like online mail, but it dosent work

because I dont have a mail server and Im using windows. So I cant do

anything about it right?

--

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







This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*

yeah I can send to the SMTP server of my ISP, but no where else.

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



Re: [PHP] mail()

2005-08-17 Thread George B

Shaw, Chris - Accenture wrote:


yeah I can send to the SMTP server of my ISP, but no where else.


If you can send to the smtp server then your ISP should deliver the email.

If you have not filled in the sendmail_from var in the php.ini correctly,
they cannot send back a mail saying there was a problem with the delivery.






This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*
Ok guys! It has sent the mail succesfully everywhere! Now one more 
thing. How do I make it so I can receive mail? I am using my ISP's POP 
server but I dosent send back because my e-mail is [EMAIL PROTECTED] How 
do I setup my own domain and does it cost money for an e-mail?


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



Re: [PHP] mail()

2005-08-17 Thread George B

André Medeiros wrote:

If you want to receive e-mails from the outside, yes, you'll have to
register a domain, configure an MTA to work on windows and all that
jazz.

Besides, if you want to manage pop, you might as well start looking at
the php4-imap / php5-imap module to be able to work with POP more
easily.

I might be mistaken, but I believe that installing an MTA on your PC
will allow you to send/receive e-mails locally. Not sure if that
suffices for your sittuation though.

Either way, check Jay's google queries. They might give you an insight
on some MTA servers you can use (I had to code a webmail application
once and I found a few free MTA servers, so I believe you'll be able
to do that to without breaking a swet :)

Good luck with your project!

On 8/17/05, George B <[EMAIL PROTECTED]> wrote:


Shaw, Chris - Accenture wrote:



yeah I can send to the SMTP server of my ISP, but no where else.


If you can send to the smtp server then your ISP should deliver the email.

If you have not filled in the sendmail_from var in the php.ini correctly,
they cannot send back a mail saying there was a problem with the delivery.






This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*


Ok guys! It has sent the mail succesfully everywhere! Now one more
thing. How do I make it so I can receive mail? I am using my ISP's POP
server but I dosent send back because my e-mail is [EMAIL PROTECTED] How
do I setup my own domain and does it cost money for an e-mail?

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



Can you send a link to a free MTA server please??

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



[PHP] from database to links

2005-08-23 Thread George B
You know on forums when you make a topic right away it makes like a new 
link to your topic. How do you do that in PHP?


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



[PHP] problem with ' or "

2005-08-23 Thread George B
I made a script that posts data into a database but it has a problem 
whenever I enter a ' or a ". How do I bypass this problem?


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



Re: [PHP] problem with ' or "

2005-08-23 Thread George B

Jasper Bryant-Greene wrote:

George B wrote:

I made a script that posts data into a database but it has a problem 
whenever I enter a ' or a ". How do I bypass this problem?



If it is MySQL, use mysql_real_escape_string() [1]. If any other 
database, have a look in the PHP manual [2] for the relevant function, 
or as a last resort use addslashes().


Jasper

[1] http://www.php.net/mysql_real_escape_string
[2] http://www.php.net/docs.php

Where do I put the code in?

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



Re: [PHP] problem with ' or "

2005-08-23 Thread George B

Jasper Bryant-Greene wrote:

George B wrote:


Jasper Bryant-Greene wrote:


George B wrote:

I made a script that posts data into a database but it has a problem 
whenever I enter a ' or a ". How do I bypass this problem?



If it is MySQL, use mysql_real_escape_string() [1]. If any other 
database, have a look in the PHP manual [2] for the relevant 
function, or as a last resort use addslashes().


Jasper

[1] http://www.php.net/mysql_real_escape_string
[2] http://www.php.net/docs.php



Where do I put the code in?



Example:

$value = mysql_real_escape_string($_POST['value']);
$results = mysql_query("SELECT * FROM sometable WHERE field='$value'");

Jasper

THANKS!! it works!!

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



Re: [PHP] from database to links

2005-08-24 Thread George B

Richard Lynch wrote:

On Tue, August 23, 2005 3:52 pm, George B wrote:


You know on forums when you make a topic right away it makes like a
new
link to your topic. How do you do that in PHP?



$_POST[new_topic]";
  }
?>

http://php.net/mysql_insert_id
is probably the piece of the puzzle you were missing.


How did you get this in your link?

topics.php?topic_id=$topic_id

I cant figure.

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



[PHP] Error #1136

2005-08-24 Thread George B

Column count doesn't match value count at row 1

What does that mean? I have an id auto_increment and it breaks everytime 
 because of that error. This has never happend before...


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



[PHP] make it remember

2005-08-24 Thread George B
Ok, I am doing a sort of a project right now... It is like a php chat 
room that records every message into a database. Now, on the first post 
I want it to like set the name, so on first post it would say Name: and 
you set your name, then on every other message you post it just says 
Posted by and remembers your name from the last entry. Is this anyhow 
possible?


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



Re: [PHP] make it remember

2005-08-24 Thread George B

Robert Cummings wrote:

On Thu, 2005-08-25 at 00:10, George B wrote:

Ok, I am doing a sort of a project right now... It is like a php chat 
room that records every message into a database. Now, on the first post 
I want it to like set the name, so on first post it would say Name: and 
you set your name, then on every other message you post it just says 
Posted by and remembers your name from the last entry. Is this anyhow 
possible?



Check session... if no name, display name prompt, otherwise don't
display name prompt.

Cheers,
Rob.

which would I choose.
http://us2.php.net/manual-lookup.php?pattern=sessions

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



Re: [PHP] make it remember

2005-08-25 Thread George B

Robert Cummings wrote:

On Thu, 2005-08-25 at 00:19, George B wrote:


Robert Cummings wrote:


On Thu, 2005-08-25 at 00:10, George B wrote:


Ok, I am doing a sort of a project right now... It is like a php chat 
room that records every message into a database. Now, on the first post 
I want it to like set the name, so on first post it would say Name: and 
you set your name, then on every other message you post it just says 
Posted by and remembers your name from the last entry. Is this anyhow 
possible?



Check session... if no name, display name prompt, otherwise don't
display name prompt.

Cheers,
Rob.


which would I choose.
http://us2.php.net/manual-lookup.php?pattern=sessions




In brief:

if( isset( $_POST['userName'] ) && !empty( trim( $_POST['userName'] ) )
)
{
//
// Save userName to session.
//
$_SESSION['userName'] = trim( $_POST['userName'] );
}

if( isset( $_POST['message'] ) && !empty( trim( $_POST['message'] ) )
&&
isset( $_SESSION['userName'] ) )
{
//
// Handle submission of message.
//
}

if( !isset( $_SESSION['userName'] ) )
{
//
// Display user name prompt.
//
}



If I do that then i get this error

Fatal error: Can't use function return value in write context in 
myfilename line 2


What does that mean. And one more thing, on the code where it says
if( !isset( $_SESSION['userName'] ) )
Does that mean that in this code


the method is session?

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



[PHP] invert

2005-08-25 Thread George B
I have written a shoutbox, and it works great, but I am wondering... 
When a user posts a shout it goes below the first shout. Like the 
auto_increment puts the ID up higher. I need it to go about the first 
shout, so like the auto_increment would invert. Someone told me this is 
possible through PHP. Is that true? and if so how do you do it?


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



Re: [PHP] invert

2005-08-25 Thread George B

Jordan Miller wrote:
if you are using mysql, just put the "DESC" (descending) directive at  
the end of your sql statement (default is no "DESC" directive,  meaning 
ascending). most recent records will be returned first.


Jordan


On Aug 25, 2005, at 2:21 PM, George B wrote:

I have written a shoutbox, and it works great, but I am  wondering... 
When a user posts a shout it goes below the first  shout. Like the 
auto_increment puts the ID up higher. I need it to  go about the first 
shout, so like the auto_increment would invert.  Someone told me this 
is possible through PHP. Is that true? and if  so how do you do it?


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




Where do I find DESC? I am looking at the php my admin and I see Field 
Type Length/Values Attributes Null Default** Extra No place to add DESC


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



Re: [PHP] invert

2005-08-25 Thread George B

Łukasz 'nostra' Wojciechowski wrote:

W odpowiedzi na maila (21:21 - 25 sierpnia 2005):



I have written a shoutbox, and it works great, but I am wondering...
When a user posts a shout it goes below the first shout. Like the 
auto_increment puts the ID up higher. I need it to go about the first

shout, so like the auto_increment would invert. Someone told me this is
possible through PHP. Is that true? and if so how do you do it?



mysql_query('SELECT * FROM table ORDER BY increment_field DESC');

http://dev.mysql.com/doc/mysql/en/order-by-optimization.html


or

get all output from DB into array and use array_reverse();

http://us2.php.net/manual/pl/function.array-reverse.php


If I do that... then i get this error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL 
result resource in myfile name on line 30


and on line 30 it says

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {   

I dont understand what is problem here...

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



Re: [PHP] make it remember

2005-08-25 Thread George B

Robert Cummings wrote:

On Thu, 2005-08-25 at 15:18, George B wrote:


Robert Cummings wrote:


On Thu, 2005-08-25 at 00:19, George B wrote:



Robert Cummings wrote:



On Thu, 2005-08-25 at 00:10, George B wrote:



Ok, I am doing a sort of a project right now... It is like a php chat 
room that records every message into a database. Now, on the first post 
I want it to like set the name, so on first post it would say Name: and 
you set your name, then on every other message you post it just says 
Posted by and remembers your name from the last entry. Is this anyhow 
possible?



Check session... if no name, display name prompt, otherwise don't
display name prompt.

Cheers,
Rob.


which would I choose.
http://us2.php.net/manual-lookup.php?pattern=sessions




In brief:

if( isset( $_POST['userName'] ) && !empty( trim( $_POST['userName'] ) )
)
{
   //
   // Save userName to session.
   //
   $_SESSION['userName'] = trim( $_POST['userName'] );
}

if( isset( $_POST['message'] ) && !empty( trim( $_POST['message'] ) )
   &&
   isset( $_SESSION['userName'] ) )
{
   //
   // Handle submission of message.
   //
}

if( !isset( $_SESSION['userName'] ) )
{
   //
   // Display user name prompt.
   //
}




If I do that then i get this error

Fatal error: Can't use function return value in write context in 
myfilename line 2


What does that mean.



I don't know. I don't think it comes form the snippet I sent you...
which wasn't meant to be a functional snippet, more of a overview of the
process.



And one more thing, on the code where it says
if( !isset( $_SESSION['userName'] ) )
Does that mean that in this code


the method is session?



No, it would be "post".

It sounds like you don't have a clue what you're doing. You might want
to read up on forms and sessions using PHP.

Cheers,
Rob.

nope never worked with sessions before.

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