Jump to content

couple of issues, doesnt display if username has a space + number issues?


wmguk

Recommended Posts

Hey guys,

 

Couple of things:

 

1) I have a field called login, but on some pages if the login has a space in the name it fails and doesnt pick up anything after the space.

is there a script i can add to the top of the page to ensure it doesnt lose anything?

 

2)I need to try and add together everything in one field, where login = 5...

 

for example, if the database table show

 

login | amount

 

1          7

2          3

1          9

4          5

 

then if i query login = 1, should display 16 (7+9) any thoughts on how i would do that?

 

thanks :)

the only issue is they need spaces in the usernames :(

 

 

This is the form the submit button they click to view the stats page

<form name='stats' action='stats.php' method='POST'><input type='hidden' name='login' value='" . $row['login'] . "'><input type='submit' class='main' name='Submit' value='Stats' /></form>

 

this is the query codes

 

<? 

//further up the page above the head
$login = $_POST['login']; 

//Main Script
include "scripts/connection.php"; 
if (!$con) 
{ 
die( 'Could not connect: ' . mysql_error() ); 
}
mysql_select_db($db, $con); 

$result = mysql_query("SELECT *, DATEDIFF(CURDATE(),creationdate) AS diff FROM album WHERE login = '$login'");
$result2 = mysql_query("SELECT SUM(`total`) AS `amt_sum` FROM orders WHERE loginid = '$login'");
$result3 = mysql_query("SELECT * FROM orders WHERE loginid = '$login'");

while($row = mysql_fetch_array($result3)) 
{ 
$total = $row['total'];
}

while($row = mysql_fetch_array($result2)) 
{ 
$num_rows = mysql_num_rows($result2);
$ave = $row['amt_sum'] ;
}

while($row = mysql_fetch_array($result)) 
{ 
$groom_firstname = $row['groom_firstname'];
$ceremony = $row['ceremony'];
$counters = $row['counters'];
$pricing = $row['pricing'];
$image_no = $row['image_no'];
$ordervalue = $row['ordervalue'];
$orders = $row['orders'];
$diff = $row['diff'];

$dateactived = date('jS F Y', strtotime($row['creationdate']));
$accessdetail = date('jS F Y - h:ia', strtotime($row['accessdetail']));

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.