[PHP] functions classes
Can anyone tell me if it is relatively an easy process for an experienced coder (not me) to convert a php script to mainly functions/classes. I have my own script that i would like to make more streamlined as it is becoming very difficult to work with. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: syntax error help
It works now: I replaced the last part of the sql with a variable = $my_points "; $result = mysql_query( $sql ) or die ( mysql_error() ); $rank = mysql_result( $result, 0 ); echo $rank; ?> ""Bigmark"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Can anyone tell me why this works on my localhost but gets an error on my > server: > > $sql = "SELECT COUNT(*) FROM leaderboard WHERE points >=( SELECT points > FROM > leaderboard WHERE username= '$username' )"; > $result = mysql_query( $sql ) or die ( mysql_error() ); > $rank = mysql_result( $result, 0 ); > echo $rank; > ?> > > > this is the error message but i cant figure it out: > > Your Position You have an error in your SQL syntax. Check the manual that > corresponds to your MySQL server version for the right syntax to use near > 'SELECT points FROM leaderboard WHERE username= 'ainslie' )' at -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: syntax error help
It works now: I replaced the last part of the sql with a variable = $my_points "; $result = mysql_query( $sql ) or die ( mysql_error() ); $rank = mysql_result( $result, 0 ); echo $rank; ?> ""Bigmark"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Can anyone tell me why this works on my localhost but gets an error on my > server: > > $sql = "SELECT COUNT(*) FROM leaderboard WHERE points >=( SELECT points > FROM > leaderboard WHERE username= '$username' )"; > $result = mysql_query( $sql ) or die ( mysql_error() ); > $rank = mysql_result( $result, 0 ); > echo $rank; > ?> > > > this is the error message but i cant figure it out: > > Your Position You have an error in your SQL syntax. Check the manual that > corresponds to your MySQL server version for the right syntax to use near > 'SELECT points FROM leaderboard WHERE username= 'ainslie' )' at -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] syntax error help
Can anyone tell me why this works on my localhost but gets an error on my server: =( SELECT points FROM leaderboard WHERE username= '$username' )"; $result = mysql_query( $sql ) or die ( mysql_error() ); $rank = mysql_result( $result, 0 ); echo $rank; ?> this is the error message but i cant figure it out: Your Position You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT points FROM leaderboard WHERE username= 'ainslie' )' at -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] number list
Hi, can anyone help me with this at all. i have a table leaderboard with username points etc and can echo the scores in asc order ok but what i want is to grab the scores and display a users position using their session ID. So if the scores are for example: 36 user3 22 user1 18 user4 12 user2 How do i show user 1's position on the leaderboard on their user login page. here are the fields in table 'leaderboard' ID user_id username points comp_id email -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php and dynamic forms
Does anyone have a simple example script. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php and dynamic forms
Can anyone tell me if this is possible- I currrently have a simple form with a textbox and submit button where a user chooses a number from 1-22 then on submit it opens another page with a table of results within another form. What i need is for the second form to be shown on the same page and just below form 1, then when the second form is submitted it then goes back to just form1. What i am trying to do is get rid of multiple pages and have the user stay on the same page for all admin functions. Bigmark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] config.php
Is there anyway of creating a config.php file on the fly using a form. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] install /setup script
Thanks for the help with the createdb and tables form, now can anyone help with changing the config.php (ie: host,user,password) via a form also-- so that it doesnt have to be done manually within the config script. Basically i want an install/setup page with all the form elements-- Hostname- username- Password- Choose database name- Then it installs the database and tables then redirects to the main site page and the config.php is already configured for them BigMark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms
Thanks-- i got that going-GREAT ! now i have a form that creates the database and tables, any ideas how i can get this info to change the connect_db file so that it doesnt have to be done manually. "Minuk Choi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > try this : > > $link = mysql_connect($host, $user, $pass); > > Note : No SINGLE quotes. > > In PHP, quotations are as follows > > $host = 'localhost'; > $a = '$host'; > $b = "$host"; > > echo $a; > > that prints $host > > echo $b; > > that prints localhost. > > HTH > -Minuk > > > - Original Message - > From: "bigmark" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Sunday, October 10, 2004 10:23 PM > Subject: [PHP] forms/variables/create database > > > > hi, does anyone know why this is not working, i have married 2 pieces of > > code together and i have no idea what im doing--any help is appreciated. > > I get an error that says it cant find the host--$host so obviusly its not > > passing it from the form. > > > > / > > > $host = $_POST['host']; > > $user = $_POST['user']; > > $pass = $_POST['pass']; > > $db_name = $_POST['db-name']; > > > > > > $link = mysql_connect('$host', '$user', '$pass'); > > if (!$link) { > > die('Could not connect: ' . mysql_error()); > > } > > > > if (mysql_create_db('db_name')) { > > echo "Database created successfully\n"; > > } else { > > echo 'Error creating database: ' . mysql_error() . "\n"; > > } > > ?> > > / > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] forms/variables/create database
hi, does anyone know why this is not working, i have married 2 pieces of code together and i have no idea what im doing--any help is appreciated. I get an error that says it cant find the host--$host so obviusly its not passing it from the form. / / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: row colours-- thanks!
Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] row colours
this piece of script makes alternate row colours, but i want the rows to be coloured in blocks of 8. So the first 8 rows are white then the next are mauve etc etc. Alternatively i could make the rows all the same colour , but i need a blank row after each 8 rows.? Any ideas -- if ($i%8 == 0) { print "$item_1$item_2$item_4$item_5\n"; } else { print "$item_1$item_2$item_4$item_5\n"; } --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] table formatting
This script by Rob Sossomon works great --Thanks! however could anyone tell me if its possible to make it run horizontally. at the moment the output is like this--- -- Round Game Winning team Wins 1 1 Collingwood 1 2 Melbourne 4 1 3 Fremantle 4 1 4 Brisbane 4 1 5 St Kilda 1 6 Port Adelaide 4 1 7 Kangaroos 4 1 8 West Coast 4 2 1 Richmond 2 2 Collingwood 4 2 3 Brisbane 4 2 4 West Coast 2 5 Essendon 2 6 Fremantle 2 7 Carlton 4 2 8 Hawthorn --I would like it like this Round game1wingame2 win game3 etc 1 Collingwood 4 Melbourne 4 Fremantle 4 "; print "RoundGameWinning TeamWins"; $total_points=0; /* Iterate through to make it clean */ while ($i < $number) { $item_1 = mysql_result($result, $i,"Round"); $item_2 = mysql_result($result, $i,"Game"); $item_4 = mysql_result($result, $i,"Winner"); $item_5 = mysql_result($result, $i,"Points"); /* This makes it print out in 2 separate color, depending on rows. */ if ($i%8 == 0) { print "$item_1$item_2$item_4$item_5 \n"; } else { print "$item_1$item_2$item_4$item_5 \n"; } /* Increase record count and total_points to date */ $i++; $total_points += $item_5; } /* close everything up */ print "Total Points Earned: $total_points"; print ""; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sessions
why is this not working. I am using instead of a form ($name = $_POST[name];) and linking to it from a users logged in page. $FirstName = $_SESSION['first_name']; $LastName = $_SESSION['last_name']; $name = "$FirstName , $LastName"; Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] select from db
Hi i have a football tipping database and i need to extract certain records from a users 'selections' table table name 'Selections' (rows) RoundGameName Winner Points data eg 1 1mark Hawthorn 4 (if team is a winner then 4 points added) 1 2mark Geelong 0 What i want to do is show all the above rows of a particular user and round, ie: all of user 'mark' round 1 details which includes games 1-8, the team names he picked, and the points for a win. p.s. is there a way of totaling the points as well mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] email formatting
Is it possible to have this code changed easily to make the output run horizontally instead of vertically. example of current output to email below code // //email selections to all users $sql = "SELECT email_address FROM Users"; $result = mysql_query($sql); while ($myrow = mysql_fetch_array($result)) { $email = $myrow['email_address']; $subject = "Mark's Footy Tipping Competition"; $message = "Hi, Round $Round is now closed. Selections were: $selections Thanks! Mark This is an automated response, please do not reply!"; mail($email, $subject, $message, "From: Mark<$fromemailaddress>\nX-Mailer: PHP/" . phpversion()); } /// outputs like this Hi, Round 10 is now closed. Selections were: Glen Gosnay - Game 1 Essendon Glen Gosnay - Game 2 Hawthorn Glen Gosnay - Game 3 West Coast Glen Gosnay - Game 4 Kangaroos Glen Gosnay - Game 5 Sydney Glen Gosnay - Game 6 Geelong Glen Gosnay - Game 7 St Kilda Glen Gosnay - Game 8 Brisbane Wayne Gosnay - Game 1 Essendon Wayne Gosnay - Game 2 Hawthorn Wayne Gosnay - Game 3 West Coast Wayne Gosnay - Game 4 Collingwood Wayne Gosnay - Game 5 Sydney Wayne Gosnay - Game 6 Port Adelaide Wayne Gosnay - Game 7 St Kilda Wayne Gosnay - Game 8 Brisbane Sean Dsouza - Game 1 Essendon Sean Dsouza - Game 2 Adelaide Sean Dsouza - Game 3 West Coast Sean Dsouza - Game 4 Collingwood Sean Dsouza - Game 5 Sydney Sean Dsouza - Game 6 Port Adelaide Sean Dsouza - Game 7 St Kilda Sean Dsouza - Game 8 Brisbane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how to insert form data
Well getting closer now, its inserting into the tables but they are blank (no text) Any ideas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how to insert form data
OK no errors now but no data inserted, my form must be wrong as well. NAME QUOTE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to insert form data
I am trying to learn how to take the value of $name and $quote from a form and put it in the database -whosaid but obviuosly i have it all wrong. Can anyone point out what im doing wrong. thx in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] forms and DB
Hi i urgently need a complete ---connect_db/form/results script, does anyone know of a ready to use script available and ready to use today. All i need is a connect.php page, a form to input a users name and one for some text -and also a page that shows all the table results . i have to get this on my site in the next few hours, please any help appreciated. ie: john blah blah blah blah blah markblah blah blah blah blah jenny blah blah blah blah blah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] execute script via email?
Is there a way for me to email this script so it executes the close of a round instead of doing it from the website administration . (it is a football tipping script) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php/mysql email
I have a sports tipping script and instead of using the admin to close a round off or input results ,would it be possible to do it via an email. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gmdate
Hi an anyone help here, i have a shoutbox that displays the time with each message but the time is 8 hours behind my time. //here are the headers// header("Expires: ".gmdate("D, d M Y H:i:s")."GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); I have tried a few things but they didnt work and the coder hasnt replied, i live in Perth Western Australia thankyou! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Email results
A: How can i send an email with the contents of a table B: can it be sent automatically when a certain field has data. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Drop down lists
Is it possible to have usernames from my db populated into a drop down list. If so What and where does it go to make it all work, ive tried everything i know ( which is not much by the way). Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: refresh data
Nope that didnt work! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] refresh data
At the moment this code accepts changes and deletes from the Db but when the submit button is pressed it echos- 'Record updated/edited' and i have to go back and refresh to view the updated list, how can i just have it refresh. When you open the file it shows the list but when editing it disappears. "; } elseif ($delete) { // delete a record $sql = "DELETE FROM employees WHERE id=$id"; $result = mysql_query($sql); echo "$sql Record deleted!"; } else { // this part happens if we don't press submit if (!$id) { // print the list if there is not editing $result = mysql_query("SELECT * FROM employees",$db); while ($myrow = mysql_fetch_array($result)) { printf("%s- V - %s..\n", $PHP_SELF, $myrow["id"], $myrow["first"],$myrow["last"]); printf("(DELETE)", $PHP_SELF, $myrow["id"]); } } ?> Team A: Team B: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] news service
Hi i had your php news account setup on my outlook express buti lost it what do i put as the address Mark
[PHP] forms and mysql
Hi i am very new to PHP so need some help ! i have a form which allows the user to put in 2 team names and then displays them, at the moment it displays them side by side but i need to insert V (versus) in the middle--how can i do that. I am guessing it goes in the lines of the code below somewhere, This code originally displayed someones input for --first name,last name and address so i have adapted it. Is there anyway to have the 'address' field display a set value as in a V , at the moment i have removed that part but the table field is still there, i have just hidden the form input. $result = mysql_query("SELECT * FROM teams",$db); while ($myrow = mysql_fetch_array($result)) { printf("%s %s \n", $PHP_SELF, $myrow["id"], $myrow["teama"],$myrow["teamb"]); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php