Jump to content
php.lv forumi

Nepareizi izveidota funkcija


Recommended Posts

Posted (edited)

Kas te ir nepareizi? Pat ja man nauda ir mazāk nekā ir cena, visu laiku rāda 'Var nopirkt'.

 

function vaiVarNopirkt($cena) {

$id = $_SESSION['user_id'];
$sql = mysql_query("SELECT gold FROM users WHERE id = $id");
$nauda_lietotajam = mysql_fetch_row($sql);

if ($cena < $nauda_lietotajam)
	echo "<div class='pirkt_kugi_iegadaties_var'>Var nopirkt</div>";
elseif ($cena >= $nauda_lietotajam)
	echo "<div class='pirkt_kugi_iegadaties_nevar'>Nevar nopirkt</div>";
}

Edited by yeahz
Posted (edited)

vaitad $nauda_lietotajam nesanāk masīvs ar indeksu un vērtību? nevajag kkā tā: $nauda_lietotajam['gold'] ? :)

Edited by rausis

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...