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 :)

Link to comment
Share on other sites

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']));

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.