Jump to content


gizmola

Member Since 06 May 2003
Offline Last Active Today, 02:57 PM

Posts I've Made

In Topic: getting 500 internet server error while using php email

Today, 02:54 PM

What is likely happening is, as was pointed out, you are trying to make 600 database connections.  On your host, this is limited and you are running out of resources and memory at 20, and then you get the 500 error.
 
cyberRobot's post should fix your problem and is the standard way to have code like this.  
 
You should also try and work in 2 parameters:
 
start=
count=
 
This will allow you to have this script be used to email any batch of your database.  This is the type of script you would want to run from a shell, but I'm guessing you don't have shell access to your host.
 
Taking Cyber's example and expanding on it:
 
<?php
// Get params
if (isset($_GET['start'])) {
  $start = (int)$_GET['start'];
} else {
  $start = 0;
}

if (isset($_GET['count'])) {
  $count = (int)$_GET['count'];
} else {
  //default to 600 rows
  $count = 600;
}
$count += $start;


//CONNECT TO DATABASE
$con = mysqli_connect("host","database","password");
if (!$con){die('Could not connect: ' . mysqli_error($con));}
mysqli_select_db($con,"database");
 
//GET EMAILS
$sql = "SELECT email 
        FROM emails 
        WHERE 
            id BETWEEN $start AND $count AND
            email IS NOT NULL";
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_assoc($result)) {
    echo $row['email'];
    // Send email here
}
 
//CLOSE DATABASE
mysqli_close($con);
Now you could call your script as:

email.php?start=100&count=50


In Topic: index.php

Today, 01:53 PM

Nobody can help you without clarification of your question.

 

What can't you do?

 

-Edit your index.php file on the new server?

-Having edited that file, you are still receiving the error?

 

Last but not least, you need to show us the code that causes the error message to display.


In Topic: Can we use PHP to create sites like surveymonkey.com and Job portal sites lik...

Today, 01:48 PM

Yes. You can use PHP to make any type of site you want.  It's a building block.  It's not the only building block typically used, but it can work with many other types of building blocks.

 

CMS's are built to publish content.  For the most part that content needs to be static content.  CMS's typically allow for expansion upon the basics, but they don't magically have the ability to morph into an application.  You have to write those as modules if you want to start with a CMS platform.


In Topic: How to execute Identity Switch PHP Script in Facebook Via URL? Please Help

05 May 2015 - 10:37 AM

I'm afraid it's more complicated than that, probably.  What is happening is that they are using javascript to manipulate their API.  

 

View source is not going to be as helpful as a javascript debugging tool like Firebug, which will let you actually trace what is happening, but I'm doubtful you'll be able to just get some static url's you could stick on a page.  

 

You might be able to get someone really versed in the Facebook api and javascript to create you a small app that would utilize the api to login to Facebook and then change context for you in a more efficient way for you, but it's doubtful you will be able to explore this idea yourself, unless you are capable of reverse engineering how this works in their app, and even then, if they don't want you to do this, it could be difficult to accomplish.


In Topic: Insert data in phpmyadmin

05 May 2015 - 02:31 AM

I took the last code you pasted, and fixed it.

$insert = mysqli_query("INSERT INTO 1141650_sigma22.JoinDNO (ID, FirstName, LastName, City, State) 
VALUES
(NULL, '$FirstName', '$LastName', '$City', '$State')";
if ($insert) {
    echo '<p>adding your name in list successfully</p>';
} else {
    echo '<p>Sorry, I could not add your name to list</p>';
}