0

Hi I have a code that's been working for me when my server is Cpanel. but due to ceratin issues i need to transfer to godaddy. i'm using this code before. but now it's not working. i have run a test connection and im sure i have a connection to the database, can you guys give me some help in here? thanks/ is there anything wrong in my syntax? what else can i use? thanks :)

if (!empty($name) && !empty($email) && !empty($office_id) && !empty($title) && !empty($story)) {

    $save_sql = ("INSERT INTO `tbl_amadeusmena` (filename, name, email, office_id, title, story, time) VALUES ('$img_newname','$name','$email','$office_id','$title','$story','$sql_date')");
3
Contributors
4
Replies
12
Views
3 Years
Discussion Span
Last Post by diafol
0

Your server wasn't cPanel. Nevermind.

If you want a complete answer, show more code - show your connection script (without the user/password of course) and show the code following these lines.

Any reason for the brackets around the SQL string?

0

Hi @diafol here's my code again:

processor.php

$hostname = "something.com";
$username = "user";
$dbname = "amadeusmena";

//These variable values need to be changed by you before deploying
$password = "password";
$usertable = "tbl_amadeusmena";


//Connecting to your database
mysql_connect($hostname, $username, $password) OR DIE ("Unable to 
connect to database! Please try again later.");

mysql_select_db($dbname);

if (!empty($name) && !empty($email) && !empty($office_id) && !empty($title) && !empty($story)) {

    $save_sql = mysql_query("INSERT INTO `tbl_amadeusmena` (filename, name, email, office_id, title, story, time) VALUES ('$img_newname','$name','$email','$office_id','$title','$story','$sql_date')");

    $query = mysql_query($save_sql,$con) or die(mysql_error("Could not write information to the database")); 
    header('Location:' . $uploadSuccess.'#modal-text');
    if (mysql_affected_rows($con) >= 1) { 
    //header('Location:' . $uploadSuccess.'#modal-text');

    } 
    mysql_close($con);

}
header('Location:' . $uploadSuccess.'#modal-text');

i also have this in my gallery form
gallery.php

$image_query = mysql_query ("SELECT filename, story FROM tbl_amadeusmena ORDER BY time DESC") or die(mysql_error());
while($image_data = mysql_fetch_array($image_query)){
 $imageName = stripslashes(mysql_real_escape_string($image_data['filename']));
 $story = stripslashes(mysql_real_escape_string($image_data['story'])); //commented so it wont display. like count shoul go here
 $count++; 
 echo '<div class="outer_cont">';
 echo '<div class="imagecontainer"><a href="https://site.com/folder/image_entry/'.$imageName.'" rel="prettyPhoto[gallery1]"><img class="images" src="https://site.com/folder/image_entry/'.$imageName.'"'.$count.' /></a></div><div class="details"><div class="fb-like" data-href="https://site.com/folder/image_entry/'.$imageName.'" data-colorscheme="light" data-layout="button_count" data-action="like" data-show-faces="true" data-send="false"></div> <br /> <div class="share"><a href="https://www.facebook.com/sharer/sharer.php?u=https://site.com/folder/image_entry/'.$imageName.'" target="_blank"><img src="images/share.jpg" /></a></div></div></div>';

what do you think am i doing wrong in here?

-1

m using heredocs for a php/mysql insert statement on godaddy. When the function is called the page refreshes correctly, however, the data is not being inserted into the database and no errors are appearing. I've tested locally using MAMP and when the file is uploaded to the server it does not work. Has anyone had this issue before on godaddy? Below is my insert statement and form.

{

    $sql=<<<SQL

            INSERT INTO college (member_id, name, date_entered, date_completed, degree, professor, method, friends, memory_1)
            VALUES      (
                        '{$_SESSION['SESS_MEMBER_ID']}',  
                        '{$_GET['name']}', 
                        '{$_GET['date_entered']}', 
                        '{$_GET['date_completed']}',
                        '{$_GET['degree']}',
                        '{$_GET['professor']}',
                        '{$_GET['method']}',
                        '{$_GET['friends']}',
                        '{$_GET['memory_1']}'
                        )
0

@jhon

This discussion is on-going and you've now hijacked it with your own question. It would be more polite to start your own thread.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.