Jump to content
php.lv forumi

Recommended Posts

Posted

Man sanāk izvadīt datus.

 

<?php
$result1 = mysql_query("SELECT website FROM extras WHERE id='{$_GET['id']}'");
while($rows = mysql_fetch_array($result1)) {
	echo 'Mājaslapa: '.$rows['website'].''; 

}
?>

 

Un man vaig lai izvada vārdu "Nav" ja website rindā nav nekas ierakstīts.

Posted
<?php
$result1 = mysql_query("SELECT website FROM extras WHERE id='{$_GET['id']}'");
  while($rows = mysql_fetch_array($result1)) {
	echo 'Mājaslapa:'.($rows['website'] ? $rows['website']:"Nav");

}
?>

Posted

vitao.web - Ieliec parametrā website 1 un izvadīs vieninieku!

Es būtu darījis tā:

Nočekojis ROW`u daudzumus ( mysql_num_rows($mainigais) ) Tad attiecīgi arī maucis, ja tas ir 0 tad izvadītu nav, ja ir 1 tad izvadītu websaiti.

Posted (edited)

Vari provēt šādi :)

<?php
$result1 = myslq_query("SELECT $website FROM extras WHERE id='$id'");
?>

 

 

kas tas pa samuģījumu :D

 

$website vietaa uzrakstu abrakadabra un lauka nosaukuma manaa tabulaa nava :D

 

neizskataas peec automaatiksas kļūdas?

 

ps: jo $website tak mainiigais lielums.. bet tabulaa lauki tak ir konstanti..

Edited by sheps

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