fobos 19 Posting Whiz in Training

I think the problem is the while statement when performing the query. If im correct, you cannot get a value from an a attribute. Put in a hidden input field or just put the id in the function as below. If you use the input, take out r in the function and use the previous function that was provided, but i think that putting the id in the function name () and calling the function with a variable will work better.

Change:

while($row = mysql_fetch_array($result) {    echo "<img src='".$row['filepath']."'>";    echo "<br>";    echo "<a id='".$row['id']."' value='".$row['id']."' onclick='getrating();'>Likes: ".$row['likes']."</a>";    echo "<br>";}while($row = mysql_fetch_array($result) {
    echo "<img src='".$row['filepath']."'>";
    echo "<br>";
    echo "<a onclick='getrating('".$row['id']."');'>Likes: ".$row['likes']."</a>";
    //echo "<input type='hidden' id='".$row['id']."' value='".$row['id']."' />";
    echo "<br>";
}

If the onclick doesnt work, tak out the '' from the '".$row."'.
Then in our function:

function getrating(r) {
    document.getElementyById(r).value;
    alert(r);
}
fobos 19 Posting Whiz in Training

Can you post your work? If you echo the date from the plugin, does it come out normal? Also, check myphpadmin or use navicat to check if the field is a time or varchar.

fobos 19 Posting Whiz in Training

Enter an email for the "%s" and see if you get a return.

SELECT * FROM blog WHERE email = %s

If you do, then again you have to use 2 session names; username and email. Having 1 session name that echo username and email will not suffice.

fobos 19 Posting Whiz in Training

MARK SOLVED if this is solved

fobos 19 Posting Whiz in Training

Did you set up your SMPT for the email so it knows how to send it?
smpt:
smpt_port:

fobos 19 Posting Whiz in Training

Hello,
a couple things i noticed.

$query_rec_manage_blog = sprintf("SELECT * FROM blog WHERE email.blog = %s",

unless your joining different tables, just use WHERE email = %s.
Also, if you echo MM_Username and you get joe | joe@blah.com then i would just use two session variable like MM_Username and MM_UserEmail. Because its probably querying WHERE email.blog = joe joe@blah.com. Try that and let me know.

fobos 19 Posting Whiz in Training

Hello,
well you can try this. Im at work so i cant test it, but try this.

if(FieldVal > 50) {
document.getElemenyById('FieldName').value = '';
}

fobos 19 Posting Whiz in Training

if you have page a.htm. wich is the parent page with 2 iframes, you type in iframe a, and it reloads iframe b with the new text. is this your question? And you can only write in the header?

fobos 19 Posting Whiz in Training

Also, its bad practice to write your php tags in shorthand.

fobos 19 Posting Whiz in Training

go to w3schools.com and go to the php section and start learning. Then come back with what you have.

fobos 19 Posting Whiz in Training

Ok. Thanks for marking the thread solved.

fobos 19 Posting Whiz in Training
fobos 19 Posting Whiz in Training
while($row = mysql_fetch_array($result) {
    echo "<img src='".$row['filepath']."'>";
    echo "<br>";
    echo "<a id='".$row['id']."' value='".$row['id']."' onclick='getrating();'>Likes: ".$row['likes']."</a>";
    echo "<br>";
}
<script type="text/javascript" >                 
function getrating(){              
    var x = document.getElementById("<?php echo $row['id']; ?>").value;              
    alert(x)                  
}    
</script>
fobos 19 Posting Whiz in Training

I could be wrong with the below statement in green.

date_default_timezone_set('America/New_York'); 
include 'connect.php'; 
$day = date('l');
$time = date('H:i:s'); 
// How to compare times if you do not include it in the select statement? You only have ID,ID,name.. No time or day is selected, so sql is only going to use those fields.
$result=mysql_query("SELECT storehours.ID, store.ID, store.Name FROM storehours, store WHERE Day = '$day' AND '$time' BETWEEN Open AND Close AND storehours.ID = store.ID ORDER BY Name");

Try

$query = "SELECT * FROM storehours, store WHERE day = '$day' AND hour open <= '$time' AND hour closed <= '$time'";
$result = mysql_query($query);

or

$query = "SELECT * FROM storehours, store WHERE day = '$day'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
if($time => $row['open'] && $time <= $row['closed']) {
    echo "Open from".$row['open'].", Closed at ".$row['close'];
} else {
    echo "not open yet";
}
fobos 19 Posting Whiz in Training

are you using localhost or computer IP in your url. localhost will be fine, but you have to configure using your computer IP

fobos 19 Posting Whiz in Training

Ok, if you wrote a session login page, then you know something about variables! If you just want the href, then use it in a variable?

if logged in
$link = "http://www.test.com/signup.php";
$img = "/images/rester.png";
$alt = "Please Register";
else
$link = "http://www.test.com/thanks.php";
$img = "/images/vote.png";
$alt = "Vote";

Hope this helps

fobos 19 Posting Whiz in Training

try using <?php $_SERVER?>/admin/validateLogin/ in your form action.

fobos 19 Posting Whiz in Training

You have an error on line 11, you need to add ">" to then end of the image tag.
Also try this.

ob_start();    
session_start();    
if(!isset($_SESSION['Username'])) {	
    echo "<a href='http://www.test.com/signup.php'><img src='/images/register.png' alt='Please Register'/></a>";	
} else {	
    echo "<a href='http://www.test.com/thanks.php'><img src='/images/vote.png' alt='Vote'></a>";
}
fobos 19 Posting Whiz in Training

Hi, found this on the web and tested it.

<script type="text/javascript">
<!--


function formatOutput(num)
{
	if (num > 10) 
		return parseInt(num);
	return num;
}

function validate(num, name)
{
	if (isNaN(num))
	{
		alert("Invalid input for " + name);
		return 1;
	}
	return 0;
}

function distance()
{
	var lat_1 = parseFloat(document.getElementById("lat1").value);
	var lat_2 = parseFloat(document.getElementById("lat2").value);
	var lon_1 = parseFloat(document.getElementById("lon1").value);
	var lon_2 = parseFloat(document.getElementById("lon2").value);
	
	
	var errorCount = 0;
	errorCount += validate(lat_1, "the first latitude");
	errorCount += validate(lat_2, "the second latitude");
	errorCount += validate(lon_1, "the first longitude");
	errorCount += validate(lon_2, "the second longitude");
	if (errorCount > 0)
		return;

	var rho = 3960.0; // earth diameter in miles
	var phi_1 = (90.0 - lat_1)*Math.PI/180.0;
	var phi_2 = (90.0 - lat_2)*Math.PI/180.0;
	var theta_1 = lon_1*Math.PI/180.0;
	var theta_2 = lon_2*Math.PI/180.0;
	
	var d = rho*Math.acos( Math.sin(phi_1)*Math.sin(phi_2)*Math.cos(theta_1 - theta_2) + Math.cos(phi_1)*Math.cos(phi_2) );
	
	var output = "Distance = " + formatOutput(d) + " miles or " + formatOutput(1.609344*d) + " kilometers";
	
	document.getElementById("result").firstChild.nodeValue = output;
}

// -->
</script>
<form method="post" action="">
	<p>Fill in the latitude and longitude of two geographic locations and 
	compute the distance between the points.</p>
	<table border="0">
		<tr>
			<td> </td>
			<td>Latitude &deg;North </td>
			<td>Longitude &deg;East </td>
		</tr>
		<tr>
			<td>First location: </td>
			<td><input type="text" id = "lat1" name="lat1" size="20" tabindex="1" /></td>
			<td><input type="text" id = "lon1" name="lon1" size="20" tabindex="2" /></td>
		</tr>
		<tr>
			<td>Second location: </td>
			<td><input type="text" id = "lat2" name="lat2" size="20" tabindex="3" /></td>
			<td><input type="text" id = "lon2" name="lon2" size="20" tabindex="4" /></td>
		</tr>
	</table>
	<p id="result">Distance ...</p>
	<p><input type="button" value="Calculate" name="B1" tabindex="5" onclick = "distance()" …
fobos 19 Posting Whiz in Training

its your localhost. Either 127.0.0.1 or your computer IP address

fobos 19 Posting Whiz in Training

Try this

<script type="text/javascript"> 
function validate() {            
    var FieldVal = document.getElementById('FieldName').value;                 
    if(FieldVal < 51) {           
        alert("Valid!");         
    } else {             
        alert("Invalid");     
    } 
}
</script>      
<input id="FieldName" type="text" name="MyField" onKeyUp="validate()" MaxLength="2" />
fobos 19 Posting Whiz in Training

Your going to have to post more of your codeing, because on line 1

$appr2 = mysql_query("SELECT from_date FROM mrfs WHERE `mrf_id`='$row[0]'") or die (mysql_error());

im guessing you are running a sql query prior to that one? If you dont mind i have a suggestion

$result = mysql_query("SELECT from_date,to_date FROM people WHERE mrf_id = '$row[0]'");
if (!$result) {
    echo 'Could not run query: ' . mysql_error();
    exit;
}
$row = mysql_fetch_row($result);
$date = date("m/d/Y");
$from_date = date("m/d/Y", strtotime($row[0]-8 days"));
$to_date = $row[1];
if($date >= $from_date && $date <= $to_date) {

}
fobos 19 Posting Whiz in Training

In my opinion, i think O'Reilly has the best books that cover a wide variety of subjects and things. Here are a couple that you would enjoy

Programming PHP
PHP Cookbook

Also, php.net is a good reference and has a bunch of things.

fobos 19 Posting Whiz in Training

Oh ok. Im glad you found the issue and it is working. Please mark the thread solved.

fobos 19 Posting Whiz in Training

var/www/ is the root folder where all your php documents should go. If it works there, that means that its the root directory. Trying running phpinfo in that folder.

fobos 19 Posting Whiz in Training

are you using outlook? if so use the smtp code to connect

fobos 19 Posting Whiz in Training

Mark it solved BilalAKhan!! Its down near the bottom by the quick reply.

fobos 19 Posting Whiz in Training

if your getting Hello World '; ?> it means that its echoing part of of the string.
if it wasnt working, 1) would be able to view the php page, 2) it would write it just as you have it <?php... ?>.

just write it, but try phpinfo() first

<?php phpinfo(); ?>
<?php echo "hello world"; ?>
<? echo "hello world"; ?>
fobos 19 Posting Whiz in Training

See if you can connect using this?

/* connect to gmail */
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'someone@gmail.com';
$password = 'yourpassword';

/* try to connect */
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
fobos 19 Posting Whiz in Training

Could your question be any broader? Try google.

http://www.w3schools.com/js/default.asp

fobos 19 Posting Whiz in Training

Make sure you change
sendmail_from NULL
to
sendmail_from "blah@something.com"

fobos 19 Posting Whiz in Training
<html>
<body>

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  mail("someone@example.com", "$subject",
  $message, "From:" . $email);
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='mailform.php'>
  Email: <input name='email' type='text' /><br />
  Subject: <input name='subject' type='text' /><br />
  Message:<br />
  <textarea name='message' rows='15' cols='40'>
  </textarea><br />
  <input type='submit' />
  </form>";
  }
?>

</body>
</html>

And in your php.ini make sure you have these set correctly
[mail function]
SMTP = "my.mailserver.dom" //localhost, gmail, yahoo..
smtp_port = 25
smtp_username = "" <-- If mail server requires a username
smtp_password = "" <-- If mail server requires a password

//Change values
//PHP_INI_ALL
sendmail_from NULL
//PHP_INI_SYSTEM
sendmail_path "/usr/sbin/sendmail -t -i"

Hope this helps

fobos 19 Posting Whiz in Training

Here are some questions that may be answered:
1) Have you tried booting in safe mode?
2) After you reformated, were you able to log in?
3) Did you install a program, then the BSOD happened after restarting?
4) Maybe there is a hardrive failure or bad OS disc?

Hopefully this can get the ball rolling for other people to chime in.

fobos 19 Posting Whiz in Training

shailu.thakre, i dont know if your using mulitple accounts for this solution, DONT DOUBLE POST. This was in MySQL forum, but under a different name.

$sql = "SELECT entries.*, catagories.cat
FROM entries, catagories
WHERE entries.cat_id = catagories.id
ORDER BY dateposted DESC
LIMIT 1;";

fobos 19 Posting Whiz in Training

Its above the quick reply on the bottom.

fobos 19 Posting Whiz in Training

Close...

fobos 19 Posting Whiz in Training

try puting this in pageb.php

function history(){
parent.checkHistory();
}

<body onload="history()">

fobos 19 Posting Whiz in Training

My bad thought thats what you wanted.
Well then try making two querys. Ex.

movie.html
<a href="get_reviews.php?filmid=1">Indiana Jones</a>

get_revies.php

<?php//Connection
$query = "SELECT * FROM film WHERE filmid=".GET['filmid']."; 
$result = mysql_query($query) or die(mysql_error());  
// Print out the contents of each row into a table 
$film = mysql_fetch_array($result)
?>
<?php//Connection
$query1 = "SELECT * FROM review WHERE filmid=".GET['filmid']."; 
$result1 = mysql_query($query1) or die(mysql_error());  
// Print out the contents of each row into a table 
$review = mysql_fetch_array($result1)
?>

<?php echo $film['filmid'] - $film['filmname'] - $review['filmreview'] ?>

This will only work if the film id is the same for both tables.

Another solution till you find another one.
fobos 19 Posting Whiz in Training

In order to do this, we have to join the table when we execute the query.

<?php
//Connection
$query = "SELECT film.filmname, review.filmreview FROM film, review WHERE film.filmid= review.filmid";
	 
$result = mysql_query($query) or die(mysql_error());


// Print out the contents of each row into a table 
while($row = mysql_fetch_array($result)){
	echo $row['filmname']. " - ". $row['filmreview'];
	echo "<br />";
}
?>

Hope this helps

fobos 19 Posting Whiz in Training

If you want to insert data into 2 tables in the same database, then use UNION. If you have 2 databases, but same table name, 1) make sure you have the same fields, 2) use 2 connections for each database.

fobos 19 Posting Whiz in Training

If you installed MySQL, then you should have been prompted to insert a password. If it comes with WAMP, try using id = admin password = password or just id = admin, password = "BLANK".

fobos 19 Posting Whiz in Training

How is your database set up.. Are you storing the picture in a BLOB or locally?

fobos 19 Posting Whiz in Training

So this is what i get..

Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: Unexpected end tag : p in Entity, line: 93 in F:\xampp\htdocs\Untitled-1.php on line 24

Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: End tag : expected '>' in Entity, line: 163 in F:\xampp\htdocs\Untitled-1.php on line 24

Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: Unexpected end tag : scri in Entity, line: 163 in F:\xampp\htdocs\Untitled-1.php on line 24

Im guessing that its because that its not well written? Here is the code that you wrote

<?php
	$f = file_get_contents('http://combatarms.nexon.net/');
	$dom = new domDocument;
	$dom->loadHTML($f);
	echo $dom->getElementById('show')->nodeValue;
?>

The error is what i get above. I even tried this one..

<?php
$f = file_get_contents('http://combatarms.nexon.net/');

 $dom = new domDocument;
    $dom->loadHTML($f);
    $dom->preserveWhiteSpace = false;
    
    $t = $dom->getElementsByTagName('div'); // or getElementById('show')
    $newElement = $t->item(0)->nodeValue; // 0 to display #aaa, 1 for #bbb
    echo $newElement . "\n"
?>

I hope im not comming accros asking you to do this for me, but im stuck. youve been a help so far man. thx

fobos 19 Posting Whiz in Training

Thanks for the help cereal. i was trying to echo the website into $f, then pull the div by id. 1, how do i get the web content into a variable.. like $f = geturlcontent? then call the div. 2, can i use $t = $dom->getElementById($f); to get the div that i want? basically what im trying to do is get stats of players from one website and post it on mine. this way ppl can come to my website and view stats of players and not have to visit the original website. i accidently posted in

http://www.daniweb.com/web-development/php/threads/376665

fobos 19 Posting Whiz in Training

Thanks for the help cereal. i was trying to echo the website into $f, then pull the div by id. 1, how do i get the web content into a variable.. like $f = geturlcontent? then call the div. 2, can i use $t = $dom->getElementById($f); to get the div that i want? basically what im trying to do is get stats of players from one website and post it on mine. this way ppl can come to my website and view stats of players and not have to visit the original website

fobos 19 Posting Whiz in Training

Hello everyone,
i had a question on how to pull certain content from a website using PHP and cURL and dislay it on a page? So far from the web, this is all i was able to find out, but this just saves the coding into a text document. Lets use php.net. Say i want to grab the information from the <div id="releaseBox"> which the latest release date on the right, and just diplay it. Like if it was 5.3.3 and i refreshed my paged, then it said 5.3.4 because they updated the release version. I really hope im making sense. Thanks for the help.

<?php

$ch = curl_init("http://www.example.com/");
$fp = fopen("example_homepage.txt", "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);
curl_close($ch);
fclose($fp);
?>
fobos 19 Posting Whiz in Training

Try this attachment. It will tell you what port is being used and whats not. Next time, please post this in the correct forum. This has nothing to do with PHP, this is more of a software thing. On another note, google XAMPP. This is a really great bundle that comes with alot of different scripting languages.

fobos 19 Posting Whiz in Training

ajijacobm,
the only way you are going to be able to use mysql with dynamic coding is by using server side code. HTML and javascript will not get what you want. You will have to use ASP, Coldfusion, PHP.. etc to achieve the results that you want. Now if you want to send a drop down box using onChange event, just use

function change() {
    select1 = document.getElementById("combo_box").value;
    location.href = 'www.something.com/' + select1;
}

Sorry if the code is a little crude, but its just to give you an idea.

fobos 19 Posting Whiz in Training

post what you have all together.

fobos 19 Posting Whiz in Training

Here is a link to what you are looking for.

Click Here