mikulucky 25 Junior Poster in Training

You could use an external API, such as scribd.

Or write a program using

pdflib, then execute this from PHP.

mikulucky 25 Junior Poster in Training

Well what do you want to achieve?

mikulucky 25 Junior Poster in Training

Don't understand that bracket around variables:

The brackets around the variables is to do with the $_POST variable. When items are posted to a script they are all placed into an array. So these brackets state this part of the array.

mikulucky 25 Junior Poster in Training

<td> tags are for tables not for the selection of radio buttons. to group radio buttons together, the names of all the radio buttons should be the same, like in the example I have shown you above.

mikulucky 25 Junior Poster in Training

I don't understand the %s bit, when executed there is nothing %s, could you explain?

The '%s' means that this is a placeholder for a string, which is later filled in with the value stated later. So the first '%s' would be filled in with '$row' while the second with '$row'.

The line of code that I gave you has to be placed within the WHILE loop. So:

if (isset($_POST['search_now'])) 
{
    $result = mysql_query("SELECT * FROM bands WHERE BandName LIKE '%$BandName%'");  


    while($row = mysql_fetch_array($result)) 
    { 
        $page = sprintf( "<a href='http://www.website.com/%s'>%s</a>" , $row['PageName']  , $row['BandName']  ) ;
        echo 'Band Name:  '; 
        echo $row['BandName'] ." " . $row['Genre']; 
        echo $page;  
        echo "<br />";
    }
}

This is because you wish to create a link, however in your first example, you was trying to populate the link with data that you did not have yet, as it was before the query to the database was run.

One more thing I would tidy the code up a bit more, having each command on a new line. Well I hope that this helps :)

mikulucky 25 Junior Poster in Training

There is not one that I know of (But then again, I don't buy I build). However it should be simple to create a web application for this to integrate with google calendar and mail services, while connecting to your stock database.

mikulucky 25 Junior Poster in Training

First of all change this from:

$page = "<a href=\"http://www.website.com/$row['PageName']\">$row['BandName']</a>";

To:

$page = sprintf( "<a href='http://www.website.com/%s'>%s</a>" , $row['PageName']  , $row['BandName']  ) ;
mikulucky 25 Junior Poster in Training

No problem, it is easy to get caught up in other things. If it has worked please mark thread as solved and give rep as appropriate.

Thanks

mikulucky 25 Junior Poster in Training

Is this line

$query_update_last_login = ("UPDATE `members` set `login_count` = $login_count where `memberid`=$memberid") or die(mysql_error());

You are not actually executing a query change this line to the following:

$query_update_last_login = "UPDATE `members` set `login_count` = $login_count where `memberid`=$memberid";

mysql_query($query_update_last_login ) or die(mysql_error());

Hope that helps :)

mikulucky 25 Junior Poster in Training

Have you specified that they are in a group, they only allow for single selection if they are part of a group.

For example

<input type="radio" name="group1" value="PersonA">
<input type="radio" name="group1" value="PersonB">
<input type="radio" name="group1" value="PersonC">
mikulucky 25 Junior Poster in Training

No problem, once done, could you mark as solved and give rep as you feel appropriate?

Thanks

mikulucky 25 Junior Poster in Training

Mikulucky, thanks, I know: the six pages that work are the only ones that send anything to screen - the header works fine in them as it is correctly placed.

The one that doesn't is pure PHP, no html (and all pages begin identically anyway, that being the problem).

Have you tired, putting an exit(); after the redirect. This is because sometimes I have noticed that the header is sometimes ignored, unless the presence of and exit(); .

So;

$inactive = 20;
/* check to see if $_SESSION['timeout'] is set */
if(isset($_SESSION['timeout']) ) 
	{
	$session_life = time() - $_SESSION['timeout'];
	if($session_life > $inactive)
                {
		session_destroy();
		header('Location: logout.html');
                exit();
		}
	}
$_SESSION['timeout'] = time();
mikulucky 25 Junior Poster in Training

A header redirect has to be before any output. So once something is printed to the screen or HTML is shown, then the redirect will not work.

mikulucky 25 Junior Poster in Training

Computer Science, and take all forensics modules possible. But computer science is the most important as you would want to know how machines operate on the lowest possible level, in order to take advantage of them.

mikulucky 25 Junior Poster in Training

Well if you go with the noah idea, that the 1 ark was able to 2 two of every animal on the planet. We would only need one to fit all of humanity. As there is current around 8.7 million species of animals. Multiply that by two, thats 19.4 million animals. However to allow for the size differences such as insects and so on, I would say a save bet would be 3 arks, for the humans. All other animals DNA and plant matter is secure in vaults which can be retrieved later, no point building more arks for them.

However this is just an estimate :D

mikulucky 25 Junior Poster in Training

Hope this helps, can be turned into a function easily.

$startAmount = 0;
$endAmount = 100000;

for ($i = $startAmount; $i <= $endAmount; $i++) 
{
    if($i % 2 != 1) 
    {
      continue;
    }
 
    $d = 3; 
    $x = sqrt($i); 

    while ($i % $d != 0 && $d < $x) 
    {
        $d += 2; 
    }

    if((($i % $d == 0 && $i != $d) * 1) == 0) 
    {
        echo $i.' '; 
    }
 }
cereal commented: great solution +7
mikulucky 25 Junior Poster in Training

OOOO I forgot EMACS!!! :D

mikulucky 25 Junior Poster in Training

Also

  • Xcode
  • Netbeans
  • notepad++ sometimes :)
mikulucky 25 Junior Poster in Training

Ok I think I might have a solution here. It works from a few tests that I have done, but forgive me but its late :)

Basically it is a function that takes a string, and the number of words you would like on each page. It splits the string by this amount. It then searches each page, finding the first close HTML tag. All text before this tag is added to the previous page, with the Newpage identifier added to it.

The function returns the pages as an array for easy sorting. You might want to do quite a bit of testing on this, and optimise it a little, as it might run a little slow. But once again it is late, and I hope this helps. :)

print_r (createPages($string,700));



function createPages($string, $numberOfWords ) 
{ 
    $words = preg_split('/\s/', $string); 
    $lines = array(); 
    $line = ''; 
    
    $countedWords = 0 ;
    
    foreach ($words as $k => $word) { 
        
    	$line .= $word . " ";
    	$countedWords++;
    	
    	if ( $countedWords == 700 )
    	{
    		$pages[] = $line;
    		$line = '';
    		$countedWords = 0;
    	}
    } 
    
    $pageCounter = 0;
    foreach ($pages as $page)
    {
    	if ($pageCounter)
    	{
    		$found = strpos($page, ">");
    		if ( $found ) 
    		{
    			$start = substr ( $page , 0 , $found ) ;
    			$pages [$pageCounter-1] .= " ". $start . "><!--nextpage-->";
    			$found = 0;
    			
    		}
    	}
    	
    	$pageCounter++;
    	
    }
    
    return $pages; 
}
mikulucky 25 Junior Poster in Training

I would have two tables, one table that holds a list of restaurants, each with their ID. While the other table holds the reviews against them. For the review table, have a column that holds the ID of the restaurant that the review applies. When it comes to displaying the data, you could then use a MYSQL JOIN on this value to show each restaurant with all their reviews.

So the restaurant table fields:

  • PlaceID
  • Name
  • Address
  • Image

The Review Table

  • ReviewID
  • ReviewName
  • Rating
  • ReviewText
  • PlaceID

Therefore there will be a relation between the two tables based on the PlaceID, this also means that you can have multiple reviews for each restaurant.

Hope this helps :)

mikulucky 25 Junior Poster in Training

I have looked through your other posts, they all have the same theme. Your a student, doing an MSc, who posts their assignments online, or parts of them. Then gets members to answer them for you. If your doing an MSc surely you must have learnt in your BSc or number of years of experience in order to qualify to attend an MSc that RTM (Read The Manual).

Just google PHP and go to the PHP website. Sorry for the other members who have attempted to help him, But read through his other posts, some of them are unbelievable.

mikulucky 25 Junior Poster in Training
//This is where the problem starts
$query="SELECT ACCT_CODE FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
 
 
if($query==0){
{header("location: changepassword.php");}
else 
{header("location:login_success.php");}
}
//This is where the problem ends
else {
echo "Wrong Username or Password";
}

First of all this part

$query="SELECT ACCT_CODE FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
 
 
if($query==0){
{header("location: changepassword.php");}
else 
{header("location:login_success.php");}
}

Your setting the query to something, which is a string, so this will never be 0, so this IF condition will never be meet.

Secondly

else {
echo "Wrong Username or Password";
}

This else statement is on its own, therefore it will cause a problem, IF Statements should be like the following;

if ( condition to test)
{
    //do something
}
else
{
    // do this if, the if condition is not passed;
}

// or an if statement can be like this

if ( condition to test)
{
    // do something
}
elseif ( another test condition )
{
    //do something if the above has not been passed;
}
else
{
    // do something if none of the above have been passed;
}

For more details on IF/ELSE controls check this manual page.


So for the tail part of your code it should be similar to the following;

if ( $count )
{

    // not really sure what your wanting to do, but you can have a column in the database called 'expiredPW' that has a 1 if the password is expired and a 0 if not for example; …
mikulucky 25 Junior Poster in Training

I think you would be better off using JQuery to check the form before you pass it to the PHP script. It is better design, easier coding and generally better all round.

mikulucky 25 Junior Poster in Training

The pictures look great. Thank you for putting them on Flickr. Much appreciated.

mikulucky 25 Junior Poster in Training

But if the phone is connected physically. Could not just use card readers of USB dongles, systems that all ready in place on a lot of machines. However of you mean connected wirelessly it could be similar to bluetooth pass code for pairing. However the phone all ready being known to the machine.

mikulucky 25 Junior Poster in Training

I can't see them because I don't have facebook, do you have the album url? or flickr?

mikulucky 25 Junior Poster in Training

This is just a little bit of fun, mine would be HFS+ because of the following;

  • Seek Speed for files
  • Auto Optimisation
  • Journalling (Although technically HFSJ) but is in HFS+

Dislikes

  • Compatibility
  • Slows down when reading many files ( Badly )
mikulucky 25 Junior Poster in Training

In php, I can do more design of my website.

I also think PHP would be the best option, It is easy to learn, and allows fast development. It does not have downtime when deploying, I have a dev server and live server, so its just a matter of svn. However the draw back of PHP is that it can get really messy really easily. If speed is your main goal, then I would go for servlets and JSP.

As for using PHP for design on your website, I might have read your post wrong. But you should really sperate the logic from the design. PHP should be at least a 3 tier system, Database -> PHP -> Template, because as I said PHP gets messy, mix php with content and HTML, well its like alphabet soup.

peter_budo commented: Little contradiction there, but finally someone posting more then "me too love PHP" +0
warlord902 commented: Nice reply +0
mikulucky 25 Junior Poster in Training

Apache is installed on all macs. Do the following:

  1. Open a terminal
  2. type "cd /etc/apache2/"
  3. type "sudo pico httpd.conf", enter your password when requested
  4. find the line #LoadModule php5_module libexec/apache2/libphp5.so and remove the '#'
  5. save the file
  6. then go to system preferences, sharing and turn on 'Web Sharing' or turn it off and on if all ready on
  7. put the .php file in your sites folder.

In the web browser go to the following:

127.0.0.1/~YOUUSERNAME/nameOfYourFile.php

mikulucky 25 Junior Poster in Training

The entire line is correct, it has to be one of the three variables being passed to mysql_connect(). Or privileges for the user. A simple way to check this is to log into the SQL Server directly using that password and username.

If you are able to log in with them details and the Database is on localhost, there might be another problem of the PHP not being able to talk to the database. Check the port numbers in php.ini file match the ports that the database is listening to, and the location of 'mysql.sock', is where the php.ini files tries to look for it.

Manual for mysql_connect()

But the line of code looks fine.

mikulucky 25 Junior Poster in Training

Could you please explain this:

$conn = mysql_connect("localhost","rentwall_rentwal",")[B]X7zlBx)XgZ5"[/B]) or die ("Could not connect MySQL");

What is X7zlBx)XgZ5?

I believe that this is the password for that user to access the database, it looks dodgy to me as well, but could be acceptable.

mikulucky 25 Junior Poster in Training

Have you checked the permission tables of the database, making sure that the user has access.

mikulucky 25 Junior Poster in Training

It might be your apache configuration, sometimes PHP is not enabled. Within the httpd.conf file there is a sections called modules, find the line for loading the PHP module, and remove the '#' at the beginning. Save the file, and restart the web server. This should solve it.

However we need more detail, if you could try this.

  • Open your form in a web browser.
  • click view source
  • in the form attributes, where it would state the name of the php file, click it from the source still
  • Tell us what happens, does it work then or fail?
mikulucky 25 Junior Poster in Training

I believe that using a mobile phone would be the best option, however it could be even more secure than just having the phone on your person. How about the phone has to be known to the machine, allowing the phone to connect to the machine via a wireless technology. Then the user is then required to enter a pin on the phone. Similar to the iPhone with WIFI sync.