you can click it to see the error part... then paste it here so i can examine
you can click it to see the error part... then paste it here so i can examine
i don't know why its not calling the jfunc(), where did you put the javascript? can u put it on the head <head> section of the page, coz i dont know what's wrong here
that's weird??? coz. i can redirect here in my test
this is just a sample script so i can test the redirection
<script type="text/javascript">
function jfunc(athlete,event,res){
var result = document.getElementById('time'+res).value;
window.location = "?athlete="+athlete+"&event="+event+"&res="+result;
}
</script>
<a href='javascript:void(0)' onclick="jfunc(1,1,1)" />click</a><input type="text" name="time1" id="time1" />
ok...upon clicking the update button did it reload? can you paste the query string? i mean the url generated upon clicking the update. coz you will see there if what value are been passed, as i examined you code in order to reach the update and your echoed $sql we have to satisfy the if statement
if ((isset($_GET['action']))&&($_GET['action']=='UpdateResult'))
if clicking the update button regenerates this url
mathleteresults.php?action=UpdateResult&athlete_id=187&event=100m swim&result=1:30
so that means we had these data
$_GET = 'UpdateResult'
$_GET = 187
$_GET = '100m swim'
$_GET = '1:30'
so because of the $_GET = 'UpdateResult' we satisfied the if statement and we should access the update part.
one way of saying thanks is marking this thread solved :)
coz there is wrong with you update
$sql = "UPDATE event_results set result='".$i."' Where event='$event' and athlete_id='$id'";
why are you passing the $i?
it should be
$id = $_GET['athlete_id'];
$event = $_GET['event'];
$result = $_GET['result'];
$sql = "UPDATE event_results set result='".$result."' Where event='".$event."' and athlete_id='".$id."'";
paste your code so we can help you
lol you didn't put a value fied on you option tag
<option style="width: 170px;">1</option>
changed it to
<option style="width: 170px;" value="1">1</option>
what ie version? 6, 7 or 8?
are you sure? that seems like the database schema you gave to me, well if that's really the file name then try editing this part
from
window.location='?action=UpdateResult&athlete_id='+athlete+'&event='+event+'&result='+result;
to
window.location='mathleteresults.php?action=UpdateResult&athlete_id='+athlete+'&event='+event+'&result='+result;
do you understand what Will is saying to you? he means put $row inside an image tag, like this
echo "<img src='".$row['image']."' />";
may i know the name of your main php file?
this code
// Make the query:
$query = "SELECT * FROM athlete,events,event_results where athlete.athlete_id = event_results.athlete_id
and events.event = event_results.event ORDER BY $order_by LIMIT $start, $display";
$res = mysql_query($query);
echo '<form name="form1" action="mathleteresults.php" method="post">';
// Table header:
echo '<table align="center" cellspacing="0" cellpadding="5" width="155%">
<tr>
<td align="left"><b>Edit</b></td>
<td align="left"><b>Delete</b></td>
<td align="left"><b>FirstName</b></td>
<td align="left"><b>LastName</b></td>
<td align="left"><b><a href="mathleteresults.php?sort=eventorder">Event</a></b></td>
<td align="left"><b><a href="mathleteresults.php?sort=result">Results</a></b></td>
<td align="left"><b>Date</b></td>
</tr>';
// Fetch and print all the records....
$bg = '#eeeeee';
while ($row = sqlFetchArray($res)) {
$bg = ($bg=='#eeeeee' ? '#ffffff' : '#eeeeee');
//echo $a_id;
echo '<tr bgcolor="' . $bg . '">
<td align="left"><a href="?action=UpdateResult&athlete_id=' . $row['athlete_id'] . '&event=' .$row['event'] . '&result=' . $row['result'] .'" >Update </a></td>
<td align="left"><a href="?action=DeleteResult&athlete_id=' . $row['athlete_id'] . '">Delete</a></td>
<td align="left">' . $row['first_name'] . '</td>
<td align="left">' . $row['last_name'] . '</td>
<td align="left"><input name="event" size="10" id="event" value="' . $row['event'] . '"></td>
<td align="left"><input type="text" name="result" id="result" size="8" value="' . $row['result'] . '" ></td>
<td align="left">' . $row['date'] . '</td>
</tr>';
} // End of WHILE loop.
echo '</table>';
echo '</form>';
//request to edit/update result
if ((isset($_GET['action']))&&($_GET['action']=='UpdateResult'))
{ echo "just cant find the result";
$time = $_GET["result"];
$event = $_GET['event'];
$id = $_GET['athlete_id'];
$sql = "UPDATE event_results set result='".$time."' Where event='$event' and athlete_id='$id'";
echo $sql;
$res = sqlQuery($sql); if(sqlErrorReturn()) sqlDebug(__FILE__,__LINE__,sqlErrorReturn());
if (!empty($res))
return 99;
return false;
}
what's the name of this php file?
athlete, event and res are javascript variables, during a click event
<a href="javascript:void(0)" onclick="jfunc('.$row["athlete_id"].','.$row["event"].','.$i.'" />Update</a>
and they will be redirection by using the window.location
window.location='?action=UpdateResult&athlete_id='+athlete+'&event='+event+'&result='+result;
dude try removing your html code in your getList.php, just remain your php code
<?php
$q=$_GET["q"];
$con = mysql_connect('localhost', '********', '********');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("*******", $con);
$sql="SELECT * FROM resi_list WHERE id = '".$q."'";
$result = mysql_query($sql);
//php code. this loops through the table based on the variable sent.
while($row = mysql_fetch_array($result))
{
echo'<div id="imgDiv">';
echo'<div id="topimg"><img src='. $row['img1'] .' border=0></div>';
echo'<div id="botPics">';
echo'<div id="smallImg1"><img src=' . $row['img2'] . ' border=0></div>';
echo'<div id="smallImg2"><img src=' . $row['img3'] . ' border=0></div>';
echo'<div id="smallImg3"><img src=' . $row['img4'] . ' border=0></div>';
echo'</div>';
echo'</div>';
}
mysql_close($con);
?>
you dont need another html page inside an html page, and kindly remove the <div id="imgDiv">, coz the main page already had that div, and you dont have to create another inside of it.
echo'<div id="topimg"><img src='. $row['img1'] .' border=0></div>';
echo'<div id="botPics">';
echo'<div id="smallImg1"><img src=' . $row['img2'] . ' border=0></div>';
echo'<div id="smallImg2"><img src=' . $row['img3'] . ' border=0></div>';
echo'<div id="smallImg3"><img src=' . $row['img4'] . ' border=0></div>';
echo'</div>';
take note, ie is the most buggy in all browser, so you must be clean in you code coz ie will output incorrect results if you dont.
hope that helps
just take extra careful when you use echo, if you use double qoutes, use single qoutes inside, if you want to use double qoutes then escape it, and if you use single qoutes it vice versa.
example
echo "<input type='text' name='txttest' />";
if you want to use double qoutes inside, escape them
echo "<input type=\"text\" name=\"txttest\" />";
if you use single qoutes on echo then you do the opposite
echo '<input type="text" name="txttest" />';
if you want to use single qoutes inside, escape them
echo '<input type=\'text\' name=\'txttest\' />';
but if you encounter concatenation, you can use single or double qoutes, it doesn't matter coz concatenation makes it outside the string
echo "<input type='text' name='txttest' value='".$row['sample']."' />";
or just use what i have already make for you
this part
echo '<tr bgcolor="' . $bg . '">
<td align="left"><a href="javascript:void(0)" onclick="jfunc('.$row["athlete_id"].','.$row["event"].','.$i.'" />Update</a></td>
<td align="left"><a href="?action=DeleteResult&athlete_id=' . $row['athlete_id'] . '">Delete</a></td>
<td align="left">' . $row['first_name'] . '</td>
<td align="left">' . $row['last_name'] . '</td>
<td align="left"><input name="event" size="10" id="event" value="' . $row['event'] . '"></td>
<td align="left"><input type="text" name="textres'.$i.'" id="textres'.$i.'" value="'.$row['result'].'" /></td>
<td align="left">' . $row['date'] . '</td>
</tr>';
i hope you get my point
hehe your ajax example is from w3schools...
ok first make a database for names, then query them all
then changed this part from an array
// Fill up array with names
$a[]="Anna";
$a[]="Brittany";
$a[]="Cinderella";
$a[]="Diana";
$a[]="Eva";
$a[]="Fiona";
$a[]="Gunda";
$a[]="Hege";
$a[]="Inga";
$a[]="Johanna";
$a[]="Kitty";
$a[]="Linda";
$a[]="Nina";
$a[]="Ophelia";
$a[]="Petunia";
$a[]="Amanda";
$a[]="Raquel";
$a[]="Cindy";
$a[]="Doris";
$a[]="Eve";
$a[]="Evita";
$a[]="Sunniva";
$a[]="Tove";
$a[]="Unni";
$a[]="Violet";
$a[]="Liza";
$a[]="Elizabeth";
$a[]="Ellen";
$a[]="Wenche";
$a[]="Vicky";
to
$sql = mysql_query("SELECT name FROM users"); //sample table users
while($row=mysql_fetch_array($sql)){
$a[] = $row['name'];
}
just read the link for better understanding...
actually you did updated it, but you didn't notice the change coz your still passing the old value....
examine your query string....
<a href="?action=UpdateResult&athlete_id=' . $row['athlete_id'] . '&event=' .$row['event'] . '&result=' . $row['result'] .'" >Update </a>
have you noticed? your result value is equal to the old result value which is $row. your result should be the value of the result textfield not the $row which is the old one. So let's use javascript to get the value of the result textfield.
put this in the head section of your html code
<script type="text/javascript">
function jfunc(athlete,event,res){
var result = document.getElementById('textres'+res).value;
window.location='?action=UpdateResult&athlete_id='+athlete+'&event='+event+'&result='+result;
}
</script>
then replace your old anchor tag from
<a href="?action=UpdateResult&athlete_id=' . $row['athlete_id'] . '&event=' .$row['event'] . '&result=' . $row['result'] .'" >Update </a
to
<a href='javascript:void(0)' onclick="jfunc(<?=$row['athlete_id']?>,<?=$row['event']?>,<?=$i?>)" />Update</a>
and replace your result textfield from
<input type="text" name="result" id="result" size="8" value="' . $row['result'] . '" >
to
<input type="text" name="textres<?=$i?>" id="textres<?=$i?>" value="<?=$row['result']?>" />
then put $i=1 above while ($row = sqlFetchArray($res)) and increment the $i in the end of the loop, it will look something like this
$i = 1;
while ($row = sqlFetchArray($res)) {
$bg = ($bg=='#eeeeee' ? '#ffffff' : '#eeeeee');
echo '<tr bgcolor="' . $bg . '">
<td align="left"><a href="javascript:void(0)" onclick="jfunc('.$row["athlete_id"].','.$row["event"].','.$i.'" />Update</a></td>
<td align="left"><a href="?action=DeleteResult&athlete_id=' . $row['athlete_id'] . '">Delete</a></td>
<td align="left">' . $row['first_name'] . '</td>
<td align="left">' . $row['last_name'] . '</td>
<td align="left"><input name="event" size="10" id="event" value="' . $row['event'] . '"></td>
<td align="left"><input type="text" name="textres'.$i.'" id="textres'.$i.'" value="'.$row['result'].'" /></td>
<td align="left">' . $row['date'] . '</td>
</tr>';
$i++; …
just use my attached sql file, i already created that database for you just change the file extension to .sql ex. test2.sql and import it to your database via phpmyadmin
changed the two &stmt to $stmt
$stmt->bindParam(':username', &username, PDO::PARAM_STR);
$stmt->bindParam(':password', &password, PDO::PARAM_STR, 40);
yeah virangya is right, session is the solution to your problem, try this tutorial about session
one thing is for sure.... your PHP tags is not parsed... maybe you have problem on your PHP server, or maybe you didn't put it the root directory or you didn't save it as .php
its because of htaccess, try searching about htaccess so you know what it can do about rewriting urls
do you know that in order for you to use php mail() function, u need to set-up a working email system first.
maybe ill get back to you tommorow coz. its already 12:41 am here... it's so late
1st of all re-design your database... coz its very hard to join tables coz your not using foreign keys
paste this code in the SQL portion of phpmyadmin to test the query results
SELECT a.firstname, a.lastname, e.name, er.result, e.date
FROM event_results er
LEFT JOIN athletes a ON ( er.athlete_id = a.id )
LEFT JOIN EVENTS e ON ( er.event_id = e.id )
here just rename this to any name you want and append a .sql ex. test.sql and import it to phpmyadmin
-- phpMyAdmin SQL Dump
-- version 3.2.0.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 26, 2010 at 12:29 AM
-- Server version: 5.1.37
-- PHP Version: 5.3.0
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `test2`
--
-- --------------------------------------------------------
--
-- Table structure for table `athletes`
--
CREATE TABLE IF NOT EXISTS `athletes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(100) NOT NULL,
`lastname` varchar(100) NOT NULL,
`gender` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `athletes`
--
INSERT INTO `athletes` (`id`, `firstname`, `lastname`, `gender`) VALUES
(1, 'Naruto', 'Uzumaki', ''),
(2, 'Sasuke', 'Uchiha', '');
-- --------------------------------------------------------
--
-- Table structure for table `events`
--
CREATE TABLE IF NOT EXISTS `events` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`category` varchar(100) NOT NULL,
`date` datetime NOT NULL,
`location` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `events`
--
INSERT INTO `events` (`id`, `name`, `category`, `date`, `location`) VALUES
(1, 'Kunai Throwing', 'men', '2010-06-30 00:08:08', 'Konoha'),
(2, 'Genjutsu Casting', 'women', '2010-06-29 00:08:16', 'Suna');
-- --------------------------------------------------------
--
-- Table structure for table `event_results`
--
CREATE TABLE IF NOT EXISTS `event_results` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`athlete_id` int(11) NOT NULL,
`event_id` int(11) NOT NULL,
`result` time NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `event_results`
--
INSERT INTO `event_results` (`id`, `athlete_id`, `event_id`, `result`) VALUES
(1, 1, 1, '05:30:00'),
(2, 2, 2, '05:50:00');
redesign your database
if thats the case then that means that the 'result' field in one of your table is null or empty, are you sure that you named it as 'result' not 'results'. As i see you had 3 tables, if you really want me to help you. can you gave me your database schema so i can test it here. Coz i can just imagine here and visualize what are the data in your database. im not sure if you query is right.
your drop down and submit button has the same name, thats causing ambiguity
<select name="country" id="country" class="tb12" title="Search country">
<option value="England">England</option>
<option value="USA">USA</option>
</select>
and
<input name="country" type="submit" id="country" class="tb11" value="Search country" title="Search by country" />
whooaaaaa! thats a lot of code! my braincells are depleted!
here i fixed it, i escape all the single qoutes(') in your $mail_body string
<?php
include_once "connect_to_mysql.php";
$sql = mysql_query("SELECT * FROM mail WHERE field_9='0' AND field_8='max' LIMIT 20");
$numRows = mysql_num_rows($sql); // Added for "End Campaign Check" at the bottom of this file(not shown on the video)
$mail_body = '';
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$email = $row["field_4"];
$name = $row["field_5"];
$mail_body = '
<html>
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" bgcolor=\'#505050\' >
<STYLE>
.headerTop { background-color:#ffffff; border-top:0px solid #000000; border-bottom:1px solid #FFFFFF; text-align:center; }
.adminText { font-size:10px; color:#ff7700; line-height:200%; font-family:verdana; text-decoration:none; }
.headerBar { background-color:#e0e0e0; border-top:0px solid #333333; border-bottom:10px solid #FFFFFF; }
.title { font-size:20px; font-weight:bold; color:#ff7700; font-family:arial; line-height:110%; }
.subTitle { font-size:11px; font-weight:normal; color:#666666; font-style:italic; font-family:arial; }
td { font-size:12px; color:#000000; line-height:150%; font-family:trebuchet ms; }
.sideColumn { background-color:#e0e0e0; border-right:1px solid #505050; text-align:left; }
.sideColumnText { font-size:11px; font-weight:normal; color:#999999; font-family:arial; line-height:150%; }
.sideColumnTitle { font-size:15px; font-weight:bold; color:#333333; font-family:arial; line-height:150%; }
.footerRow { background-color:#505050; border-top:10px solid #FFFFFF; }
.footerText { font-size:10px; color:#ffffff; line-height:100%; font-family:verdana; }
a { color:#FF6600; color:#FF6600; color:#FF6600; }
</STYLE>
<table width="100%" cellpadding="10" cellspacing="0" bgcolor=\'#505050\' >
<tr>
<td valign="top" align="center">
<table width="600" cellpadding="0" cellspacing="0">
<tr>
<td style="background-color:#ffffff;border-top:0px solid #000000;border-bottom:1px solid #FFFFFF;text-align:center;" align="center"><span style="font-size:10px;color:#000000;line-height:200%;font-family:verdana;text-decoration:none;">Email not displaying correctly? <a href="*|ARCHIVE|*" style="font-size:10px;color:#ff7700;line-height:200%;font-family:verdana;text-decoration:none;">View it in your browser.</a></span></td>
</tr>
<tr>
<td align="left" valign="middle" style="background-color:#505050;border-top:0px solid #333333;border-bottom:10px solid #FFFFFF;"><center><a href=""><IMG id=editableImg1 SRC="" BORDER="0" title="" alt="" align="center"></a></center></td>
</tr>
</table>
<table width="600" cellpadding="20" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="200" valign="top" style="background-color:#FFFFFF;border-right:1px solid #CCCCCC;text-align:left;">
<span style="font-size:11px;font-weight:normal;color:#505050;font-family:arial;line-height:150%;">
<p>
Attention: \' . $name . \',
</p>
<center><a href=""><IMG …
from 86 views no one comments? maybe because your question is too vague
<?php
error_reporting(0);
?>
from a developer's point of view... google is the best company in the whole world! from a very simple search engine. Now look at google. they had made so many things, google map, google translate, google chrome, google OS and so many more, they are a brilliant dev team and i idolized the people behind google projects. they are a bunch of genius people. I love google!
then ill get back to friendster if that happens
yeah dont worry itech7 i believe you... what do you get from lying? nothing...
or you rename your id field or table name to something else, one thing is for sure there an error in query
SELECT * FROM `likes`
it should be
SELECT * FROM likes
Hi all,
so how superstitious are you?
mind sharing them?
my superstitious beliefs are:
- when you cut your nails at night, it brings bad luck
- when you see a black cat it brings bad luck
- when you dream that you lost your teeth, someone in your family will die
hmm... whats sqlQuery($sql)?
it should be...
$sql = "UPDATE event_results set result='".$time."' Where event='$event' and athlete_id='$id'";
mysql_query($sql);
i don't think the world will end, but i think a huge destruction will happen, but the earth is still in one piece.... hmmm the "fall out" game will come to life and the survivors will come out from their vaults, going to start from scratch, people will strive to live in an post-apocalyptic world ^_^
your FREEDOM OF EXPRESSION will lead to war, i am not against it, but it should be used appropriately. RESPECT each others religion as others will kill for it.
yeah i agree.... MAYBE itech7 is lying on screenshots, but i will totally agree on him on the page load, it takes a head ache waiting on page loads, good thing i can hover on threads to see its description before i click a thread i want to engage.
what do you want to be help with?
@almostbob hahaha youre so hilarious dude haha, but i had another thing in mind
<?php
echo "End of the World?"
?>
about the tutorial site, i prefer w3schools
http://w3schools.com
yeah i get what you mean dude like, the facebook share link, when you attach a link a small thumbnail of the site wil be displayed. i dont know that but i know how to get site contents and convert it so string.
<?php
echo file_get_contents('http://www.example.com/');
?>
<?php
$sql = mysql_query("SELECT user_id, gender FROM user_table WHERE user_id='".$user_id."'");
$row = mysql_fetch_array($sql);
$id = $row['user_id'];
$gender = $row['gender'];
$sql2 = mysql_query("SELECT user_id FROM user_table WHERE user_id!='".$id."' AND gender!='".$gender."'");
while($row2 = mysql_fetch_array($sql2)){
echo $row2['id']."<br />"; // test result, echoed only user_id, since you only want the opposite sex's id
}
?>
i hope this helps :)
what does your $row holds in your database? if it's an image then you dont just echo it directly, you have to put it on an <img> tag
echo "<img src='".$row['content']."' />";
i hope i get your point :)
you may have created some line breaks, better paste the code so we can help you