[PHP] functions classes

2006-08-25 Thread Bigmark
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] syntax error help

2006-08-20 Thread Bigmark
Can anyone tell me why this works on my localhost but gets an error on my
server:

?php
$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

2006-08-20 Thread Bigmark
It works now: I replaced the last part of the sql with a variable

?php
$sql = SELECT COUNT(*) FROM leaderboard WHERE points = $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:

 ?php
 $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

2006-08-20 Thread Bigmark
It works now: I replaced the last part of the sql with a variable

?php
$sql = SELECT COUNT(*) FROM leaderboard WHERE points = $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:

 ?php
 $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] number list

2006-08-19 Thread Bigmark
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] php and dynamic forms

2006-08-14 Thread Bigmark
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] Re: php and dynamic forms

2006-08-14 Thread Bigmark
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] config.php

2004-10-11 Thread bigmark
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] forms/variables/create database

2004-10-10 Thread bigmark
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
$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



Re: [PHP] forms

2004-10-10 Thread bigmark
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.
 
  /
  ?php
  $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] install /setup script

2004-10-10 Thread bigmark
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



[PHP] row colours

2004-06-05 Thread BigMark
 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 tr
bgcolor=\#ff\td$item_1/tdtd$item_2/tdtd$item_4/tdtdcen
ter$item_5/center/td/tr\n;
 }
  else
 {
 print tr
bgcolor=\#ff\td$item_1/tdtd$item_2/tdtd$item_4/tdtdcen
ter$item_5/center/td/tr\n;
 }

---

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



[PHP] Re: row colours-- thanks!

2004-06-05 Thread BigMark
Thanks!

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



[PHP] select from db

2004-06-04 Thread BigMark
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] sessions

2004-06-04 Thread BigMark
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] table formatting

2004-06-04 Thread BigMark
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


?php
session_start();
include(connect.php);
$Name = $_SESSION['first_name'] .   . $_SESSION['last_name'];

$sql = SELECT * FROM Selections WHERE Name = '$Name';
$result = mysql_query($sql);

/* Determine the number of records returned */
while ($row = MYSQL_FETCH_array($result))
$number = mysql_numrows($result);


/* Start printing to make it look good */
print table width=\30%\ cellspacing=\0\ cellpadding=\0\
border=\0\;
print
trthRound/ththGame/ththWinning
Team/ththWins/th/tr;

$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 tr
bgcolor=\#99\tdcenter$item_1/center/tdtdcenter$item_2/ce
nter/tdtdcenter$item_4/center/tdtdcenter$item_5/center/td
/tr\n;
 }
 else
 {
 print tr
bgcolor=\#66\tdcenter$item_1/center/tdtdcenter$item_2/ce
nter/tdtdcenter$item_4/center/tdtdcenter$item_5/center/td
/tr\n;
 }



/* Increase record count and total_points to date */
 $i++;
 $total_points += $item_5;
}
/* close everything up */

 print trth colspan=5Total Points Earned: $total_points/th/tr;
 print /table;

?

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



[PHP] how to insert form data

2004-06-02 Thread BigMark
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
include(connect.php);
$name = $_POST['name'];
$quote = $_POST['quote'];
$sql = INSERT INTO whosaid values (name='$name',quote='$quote');
?

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



[PHP] Re: how to insert form data

2004-06-02 Thread BigMark
OK no errors now but no data inserted,  my form must be wrong as well.

form  method=post action=input.php
NAME
   input name=textfield type=text id=name 
QUOTE
   input name=textarea type=text id=quote 

  input type=submit name=Submit value=Submit

/form

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



[PHP] Re: how to insert form data

2004-06-02 Thread BigMark
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] email formatting

2004-06-02 Thread BigMark
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] forms and DB

2004-06-01 Thread BigMark
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?

2004-04-06 Thread BigMark
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
include(connect.php);

// Grab variables and insert into database
$x=1;
$Round = $_POST['Round'];

switch ($Round) {
 case QF:
  $y = 5;
  break;
 case SF:
 case PF:
  $y = 3;
  break;
 case GF:
  $y = 2;
  break;
 default:
  $y = 9;
  break;
}

While ($x  $y) {

 $Game = $x;
 $sql = mysql_query(UPDATE Rounds SET Closed = 'Yes' WHERE Round = '$Round'
AND Game = '$Game');
 $x++;

}
?

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



[PHP] gmdate

2004-03-19 Thread BigMark
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] php/mysql email

2004-03-19 Thread BigMark
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] Email results

2004-01-20 Thread BigMark
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

2004-01-17 Thread BigMark
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] forms and mysql

2003-12-02 Thread BigMark
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(a href=\%s?id=%s\%s %s/a \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



[PHP] news service

2003-12-02 Thread BigMark
Hi i had your php news account setup on my outlook express buti lost it what do i put 
as the address

Mark


[PHP] refresh data

2003-12-02 Thread BigMark
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.


html

?php
$db = mysql_connect(localhost, root);

mysql_select_db(mydb,$db);

if ($submit) {


  // here if no ID then adding else we're editing

  if ($id) {

$sql = UPDATE employees SET first='$first',last='$last' WHERE id=$id;

  } else {

$sql = INSERT INTO employees (first,last) VALUES ('$first','$last');

  }


  // run SQL against the DB

  $result = mysql_query($sql);


  echo Record updated/edited!p;

} elseif ($delete) {



// delete a record

$sql = DELETE FROM employees WHERE id=$id;

$result = mysql_query($sql);

echo $sql Record deleted!p;

} 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(ahref=\%s?id=%s\%s- V - %s../a\n, $PHP_SELF,
$myrow[id], $myrow[first],$myrow[last]);

   printf(a href=\%s?id=%sdelete=yes\(DELETE)/abr, $PHP_SELF,
$myrow[id]);

}

  }



  ?

  P

br


  P

  form method=post action=?php echo $PHP_self?

  ?php



  if ($id) {

?

input type=hidden name=id value=?php echo $id ?
  ?php

  }

  ?
  Team A:input type=Text name=first value=?php echo $first?
brbr
  Team B:input type=Text name=last value=?php echo $last ?brbr


  input type=Submit name=submit value=Enter Team Names

  /form

?php


}


?
/body

/html

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



[PHP] Re: refresh data

2003-12-02 Thread BigMark
Nope that didnt work!

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