php link mysql_connect localhost root thuraya_sql if link if mysql_sel

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
$link = mysql_connect('localhost', 'root', 'thuraya_sql');
if($link)
{
if(mysql_select_db('sandel_ts'))
{
$i = 0;
echo "connected <br />";
$q = mysql_query("SELECT i_channel_id, s_channel_name
FROM ts2_channels
WHERE s_channel_name IN
('LFS_UDRT', 'Warlords')");
echo mysql_num_rows($q) . " ch to delete<br />";
while(list($cid, $cname) = mysql_fetch_row($q))
{
mysql_query("DELETE FROM ts2_channel_privileges
WHERE i_cp_channel_id = " . $cid);
echo "$cname: ok " . mysql_affected_rows() . " affected<Br />";
$i++;
mysql_query("DELETE from ts2_channels WHERE i_channel_id=". $cid);
}
echo "done: $i ch deleted";
}
mysql_close($link);
}
else
{
die("could not connect to server");
}