Jump to content
php.lv forumi

netieku skaidriba


Darkangel

Recommended Posts

Kads man var palidzet ar so scriptu es jau mokos vienu laiku un netieku skaidriba

es gribu lai vins no datu bazes nolasa avatar nosaukumu piem devil.jpg

un parada vinu mana profila

 

 

<?php
require_once('auth.php');
?>
	<center>

	<?php
	$id = $auth->userid;
	$username = $auth->username;
	require("connect.php");
	$sql = "SELECT * FROM user WHERE avatar = '$id'";
	$res = mysql_query($sql);
	$row = mysql_fetch_array($res);
	echo '<img border="0" src="avatar/$row["avatar"]" width="100" height="100"><br>';
	echo "User logged:".$username."<br>";
	echo "Userid:".$id."<br>";
	?>

	</center>

Link to comment
Share on other sites

Hrrr..

 

Ja stringu iekļauj iekš dubultpēdiņām, tad visas dubulpēdiņas, kas parādās stringā, ir jāeskeipo ar \.

 

Bet vispār dari labāk šādi:

echo '<img border="0" src="avatar/'.$row["avatar"].'" width="100" height="100"><br>';

 

Un apgūsti php pamatus ;).

Link to comment
Share on other sites

×
×
  • Create New...