Jump to content
php.lv forumi

Linki


drinkits

Recommended Posts

Kā lai šiitādu skriptu pie dzīvības dabū? Galā būtu jābūt tā ka izvelk man no tbula linku nosaukumu un linku. Tas viss tiek kaartots tabulaa. Tik nevaru dabutt lai tas viss stradaa, vnk tikko saaku maaciities Mysql un daudzko veel neizprotu. Veelaak shitam pasham gribeetu veel kliku skaitiotaaju ielikt tik neizprotu kaa to dabuut. Uztaisiiju kolonnu count kuru itkaa vajadzeetu updatot bet neziinu kaa to saistiit ar php =] Luuk kur skripts:

 

<table cellpadding="0" cellspacing="0" width="609" height="50">
<!-- MSTableType="layout" -->
<tr>
	<td valign="top"> </td>
	<td valign="top"><b><font face="Verdana" size="2">Nosaukums</font></b></td>
	<td valign="top" height="19"><b><font face="Verdana" size="2">Kliki</font></b></td>
</tr>
<tr>
	<td></td>
	<td></td>
	<td height="12"></td>
</tr>
<?php
$con = mysql_connect("localhost","ttiripiri","tratataaa");
mysql_select_db("admin", $con);
$result = mysql_query("SELECT name, links FROM linki");
while($row = mysql_fetch_array($result))
$name = $row['name'];
$links = $row['links'];
 {
 echo "<tr><td width='20' valign='top'><img border='0'src='http://ripclan.lv/images/arrow.gif' width='20' height='16'></td><td width='438' valign='top'><a href='$links'>$name</a></td>";
 echo "<td height='10' width='151' valign='top'>klik</td></tr>";
 echo "</table>";
 }
mysql_close($con);
?>
</table>

 

Mysql tabula man izskataas shitaa = count, name, links

Edited by drinkits
Link to comment
Share on other sites

a' vot izstāsti man ko šis dara

while($row = mysql_fetch_array($result))
$name = $row['name'];
$links = $row['links'];
 {
 echo "<tr><td width='20' valign='top'><img border='0'src='http://ripclan.lv/images/arrow.gif' width='20' height='16'></td><td width='438' valign='top'><a href='$links'>$name</a></td>";
 echo "<td height='10' width='151' valign='top'>klik</td></tr>";
 echo "</table>";
 }

 

:)

Link to comment
Share on other sites

nu lab tgd man skripts izskataas shaads:

 

<table>
<?php
$con = mysql_connect("localhost","tiripiri","tratataaa");
mysql_select_db("admin", $con);
$result = mysql_query("SELECT name, links FROM linki");
while($row = mysql_fetch_array($result))
 {
 echo '<tr><td align="left">'.$row['name'].'</td></tr>';
 }
mysql_close($con);
?>
</table>

 

Vot kaa lai es tgd ielieku linku piem shaadi (links atrodas datubaazee):

{
 echo '<tr><td align="left"><a href="linksnodatubaazes">'.$row['name'].'</td></tr>';
 }>

Edited by drinkits
Link to comment
Share on other sites

tev tajaa tabulaa vispaar ir ieraksti?

palaid PHPMyAdmin (vai no sql konsules);

to savu "SELECT name, links FROM linki" un paskaties vai vispaar kautkas tiek atgriestc.....

edit: bubu--> kas vainas tam koda gabalam?

drinkits-->Nepaslinkoju un palaidu vinju.... straadaa... taa kaa meklee vien vainu pashaa DB un tabulu struktuuraa....

Edited by Grey_Wolf
Link to comment
Share on other sites

drinkits: nu un tālāk? Vai tu pats redzi, ka prasi izdrukāt links kolonnu, bet izdrukā name kolonnu?

 

Grey_Wolf: viņš prasa kā izdrukāt links kolonnu. Bet pats izdrukā name kolonnu. To arī viņam prasu saprast - vai viņš saprot ko nozīmē $row[...] sintakse.

Link to comment
Share on other sites

bubu--> vinsh to pats aatri saprastu ja vispaar ko izvadiitu...

+ pareizi jau vinjam bija

tur kur jaabuut links un tur kur name ...

(paskat sho no vinja 1 posta)

$name = $row['name'];
$links = $row['links'];
// NOSKIPOJU
echo "<td width='438' valign='top'><a href='$links'>$name</a></td>";

taa kaa probleem ir ieks DB (vai pat pie konekteeshanas kaa taadas...)

Link to comment
Share on other sites

tur jau taa lieta kan naf nekaadas probleemas un viss stradaa, vnk man tabulaa ir 2 kolonnas: 1. name kuraa ir linkas nosakumus bet 2. links kuraa glabaajs links uz noradiito adresi, tagad man no datbaazes jaaizvelk name un links un japaraad name kam links ir tas noradiitais no datubazes =] nevaru nekaa savadaak paskaidrot

{
 echo '<tr><td align="left"><a href="shet vajag kaukka dabuut no datubaze links">'.$row['name'].'</td></tr>';
 }>

Link to comment
Share on other sites

nevaru nekaa savadaak paskaidrot

{
 echo '<tr><td align="left"><a href="shet vajag kaukka dabuut no datubaze links">'.$row['name'].'</td></tr>';
 }>

nu tu tachu patc uzrakstiji ...

shet vajag kaukka dabuut no datubaze links vietaa ieliec '.$row['links'].' aizdomaaties bija gruuti?????

Link to comment
Share on other sites

tgd vis iet un bish vel parveidoju un pavisam jauki, pladies tef wolf =]

<table>
<?php
$con = mysql_connect("localhost","sfds","asasa");
mysql_select_db("admin", $con);
$result = mysql_query("SELECT name, links FROM linki");
while($row = mysql_fetch_array($result))
 {
 $col++;
if ( $col % 2 == 0 )
{
 $color = 'C0C0C0';
 $image = 'http://ripclan.lv/images/arrow1.gif';

}
else
{
 $color = 'FFF0B7';
 $image = 'http://ripclan.lv/images/arrow.gif';
}
 echo '<tr bgcolor="#'.$color.'"><td width="30">
	<p align="center">
	<img border="0" src="'.$image.'" width="20" height="16"></td>
	<td valign="top" height="20" width="498"><a href='.$row['links'].'>'.$row['name'].'</td></tr></td>
</tr>
';
 }
?>
</table>

Edited by drinkits
Link to comment
Share on other sites

kaa lai tagad uzlieku lai skaiti clickus, zinu ka tur ir ar Update saistiits bet nezinu kaa uzlikt lai spiezhot uz linka tiktu ierakstiits datubaazee, man ir shitaadas koloonaas

Full Texts		count   	  links   	  name
 			   0		http://www.gign.lv 	GIGN
 			   0 	   http://cs.wire.lv 	 Wire

 

kaa lai izdara taa ka count vislaiku spiezhot piem uz linka GIGN tiel palielinaats par 1, nu vnk vajag norm click counter, mekleeju bet tu visaadi suudi ar piemaisjumiem =]

Edited by drinkits
Link to comment
Share on other sites

nevar tā! spiežot uz linka tev aizies uz citu lapu.

 

liec linku navigate.php?to=GIGN

 

navigate.php vajag

update linki set `count`=`count` + 1 where name=$_GET['to']  // + viss stripslashes etc stuffs un nesauc lauku par count, tas ir keywords

select links from linki where name=$_GET['to'] 

header('Location: '.$res['links']);

Link to comment
Share on other sites

×
×
  • Create New...