Jump to content

PHP mysql selec help needed


Paldo

Recommended Posts

Hi I would like to ask how to select only one thing from database co I can use it later on.

I have a databaze containing name, login, password, account number, balance. What I need is get only account number and store it to variable, for example $balance. How can I do this.

 

Thanks

Link to comment
Share on other sites

Well tahnks I did this:

 

$result = mysql_query("SELECT account_number FROM database") or die(mysql_error());

$balance = mysql_result($result, 0, "account_numer");

 

echo $balance

 

and it's working. BUT  one last thing I would like to ask. What is  a correct way to send value of this $balance to another page so I can use it there????

 

 

I tried : echo'<a href="http://parobek.euweb.cz/transfer.php?t=$balance">Prevody</a>'; 

 

but when I echo t  on second page it prints $balance not the value of it. 

 

Thanks

 

Link to comment
Share on other sites

Hey! Shame on me that I'm putting this question on you, but I just cant solve it and I'm realy desprete by now...

 

it says: Parse error: parse error, expecting `','' or `';'' in /3w/euweb.cz/p/parobek/welcome.php on line 31

 

<html>

<body>

<?php

 

if ($name=="admin" && $password=="adnddnd" )

    { print "welcome Admin /n";

      echo'<a href="http://parobek.euweb.cz/new.php">Creating new customer</a>';

 

echo'<a href="http://parobek.euweb.cz/zmena.php">Information update</a>';

echo'<a href="http://parobek.euweb.cz/odstran.php">to delete a customer</a>';

     

}

else { $con = mysql_connect("mysql.webzdarma.cz","parobek","adnddnd");

if (!$con)

  {

  die('Could not connect: ' . mysql_error());

  }

 

mysql_select_db("parobek", $con);

 

$result = mysql_query("SELECT * FROM Customers WHERE Login='$meno' AND pasword='$heslo'");

 

while($row = mysql_fetch_array($result))

  {

  echo $row['Name'] . " " . $row['Login']. " " . $row['Password']. " " . $row['accountID']. " " . $row['balance'];

  echo "<br />";

 

$resul = mysql_query("SELECT stav FROM Customers WHERE Login=$name ") or die(mysql_error()) ;

$balance = mysql_result($resul, 0, "balance");

 

echo'<a href="http://parobek.euweb.cz/transfer.php?t='$balance'">Transfers</a>';

  }

echo $balance;

mysql_close($con);

 

}

?>

</body>

</html>

Link to comment
Share on other sites

Well thanks that worked well. I moved a bit further...

Yet something always not working. As I try to finaly use the transfered variable on a target site it says:

 

Parse error: parse error in /3w/euweb.cz/p/parobek/transfer.php on line 16

 

<html>

<head>

</head>

<body>

 

<font size="12" color="red" face="Arial, Helvetica">Zadajte cislo uctu kam previest zdroje</font>

 

<form action="http://www.parobek.euweb.cz/transferconfirm.php" method="post">

 

Cislo uctu: <input type="int" name="cisuctu" /><br />

Ciastka k prevodu: <input type="int" name="prevod" />

<input type="submit" />

</form>

 

<?php

$balance = $_GET['t']';

echo $balance;

 

?>

 

</body>

</html>

 

I realy don't know whats wrong with it... If you have a minute to ceck it out I would be thankfull...

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.