Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,227,687 members, 8,071,293 topics. Date: Wednesday, 05 February 2025 at 06:51 PM |
Nairaland Forum / Science/Technology / Webmasters / Php Help (1328 Views)
Php Help / Socket Programming In Php Help Hints ? / Email Retrieval With Php - Help Anyone? (2) (3) (4)
Php Help by debeginin(m): 12:18pm On May 15, 2009 |
I am new to PHP and have been trying to do some coding,but something is just not right with my first PHP code.Please help me point out my error(s) O! <?php $user_name="root"; $password="nbuser"; $database="Meet_A_Geek"; $server="localhost"; mysql_connect("$server","$user_name","$password" or die("cannot connect" mysql_select_db("$database" or die("cannot select DB" $mypin=$_POST['pin']; $myserialnum=$_POST['serial']; //check to see if PIN and SERIAL number indeed exist $sql="SELECT*FROM cardserials WHERE cardpins='$mypin' AND serialnumber='$myserialnum'"; $result=mysql_query($sql); $count=mysql_num_rows($result); //if ppin and SERIAL exist,check to see if it has been used by another person. if(count==1){ $myresult=mysql_query("SELECT*FROM usepins WHERE card_pin='$mypin' AND serial_no='myserialnum'"; $finite=mysql_num_rows($myresult); //if it has been used,notify user if($finite==1){ echo"Card has been used"; }else{ mysql_query("INSERT INTO usepins (card_pin,serial_no) VALUES('$mypin','$myserialnum')" } }else{ echo"check your details"; } ?> |
Re: Php Help by DualCore1: 2:27pm On May 15, 2009 |
on line 16 close the bracket u opened for the mysql_query() function. i have highlighted the bracket tht was missing below $myresult=mysql_query("SELECT*FROM usepins WHERE card_pin='$mypin' AND serial_no='myserialnum'"); |
Re: Php Help by segsalerty(m): 12:50am On May 16, 2009 |
sorry sir , at first your db connection wont work , in PHP , if you write $name = "segun"; // a string , right? and later say echo "$name"; coz you think $name holds a string value , pls dont make that mistake anymore in php, you dont put variables in double quote , php sees it as a string , hope you got that point sir, why not write your dbconnect simply as mysql_connect("localhost", "user_name" , "password; mysql_db("my db" simple! well, good other line of code for a php starter, you can go get some other php ebook/material from my website www.segsworld.com it will help ! just register to access my software downloads page! |
Re: Php Help by debeginin(m): 3:47pm On May 16, 2009 |
segsalerty:Thanks sir. Being trying to check out your site but being having little trouble opening it,but will sure try it later. Now time to try out your advice. |
Re: Php Help by segsalerty(m): 3:52pm On May 16, 2009 |
you welcome buddie ,, my site might not work , i was uploading some stuffs , not sure thats why my site isnt opening coz i can access it here anytime , just contact me |
Re: Php Help by debeginin(m): 8:59pm On May 16, 2009 |
Something is wrong somewhere, I can't connect your site from my system. uhm,bro.how do I connect? |
Re: Php Help by segsalerty(m): 9:03pm On May 16, 2009 |
uhmmm, i used to face that kind of problem too, na my host dey do something i dont uunderstand , try this , it helps sometimes when my website appears to me unexisting try clearing all caches and cookies of your web browser then reboot system after cleaning everything then , revisit my site , it sucks How was your code? did it work fine ? let me know |
Re: Php Help by debeginin(m): 9:52pm On May 16, 2009 |
No it didn't work.But i am still trying to get it work. This is what I actually have in mind to design.A Fictitious School's website for registration. 1 )Get your scratch card 2)goto schools site 3)Enter your PIN and serial number and submit 4)Goes to database and check out from a table if PIN indeed exist. 5)check to make sure that PIN has not been used by another person from A TABLE(usepins) that contains students details 6)if PIN has been used echo(pin has been used) 7)Else redirect to registration form. I don' know if I am in line from my code. Please help me out I really need this first code to work to serve as a motivation. Thanks for help so far.I will do exactly as you instruct. |
Re: Php Help by segsalerty(m): 10:03pm On May 16, 2009 |
cool job indeed you are kinda on a right part , but you have to take note of few things , how many times do you want student to use the card to access registration panel ? looking at your code, its not on the shot at all well, i can help you ! but , you said you are new to PHP , what have you really covered? how good are you with SQL , designing / setting up your db / tables matters now Uhmm if you can chat with me on segsalerty@yahoo.com am online now i can put you thru what to do, coz i dnt really like give some1 fish but i can teach you how you catch ! that was how i learned too , i am still learning self , nobody know it all i wanna stck my nose into Ajax now into Ajax now , thoum not going to be for my website use , i better be get expensive for client to fetch , you see how my site no fine ? lol |
Re: Php Help by debeginin(m): 10:48pm On May 16, 2009 |
Your site is simple and cool,I like it. I registered my membership but couldn,t activate it via the link sent to my mail.Keep getting wrong parameter. Bro's weyting I go do,although I send mail to your support sha. |
Re: Php Help by segsalerty(m): 11:01pm On May 16, 2009 |
you activate your membership already , trying to do so again will give you wrong parameter ( i should have coded it to tell you already cofirmed membership) sorry , havent got much time for the damn site for a while self, so, go logon and surf my software page to download and enjoy ! |
Re: Php Help by Nobody: 11:22pm On May 16, 2009 |
segsalerty: on the contrary, you can use a variable in a double quote, But cant use it in single quotes $var="hello"; echo "I feel like saying $var"; is valid and will return "I feel like saying hello" secondly, i guess u meant mysql_select_db() |
Re: Php Help by FlexMaster(m): 6:37pm On Jun 04, 2009 |
Dude, Did you check to make sure that you can see mysql in "phpinfo()"? I think you might need to check that first, then make a connection to the db. Thanks |
Re: Php Help by Nobody: 5:41pm On Jun 06, 2009 |
Looks like i missed the action here. Anyway, is it safe to assume that the problem has been solved? 'cos i can see the gurus got here before me, i am out. . . |
Re: Php Help by mavtrevor(m): 1:21pm On Jun 09, 2009 |
I guess i have to follow so i can learn from the gurus. |
Re: Php Help by Nobody: 7:15pm On Jun 09, 2009 |
But that first tymer coder e long small o! |
(1) (Reply)
How Can I Forward A Parked Domain To A Particular Website / I Need Free Web Hosting To Test My A Website I Just Designed / Hacker Needed Urgently.
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2025 Oluwaseun Osewa. All rights reserved. See How To Advertise. 28 |