Announcement

Collapse
No announcement yet.

PHP problem - database not updating?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Lynne
    replied
    To be honest, I don't know how they were working before when I look at your script. Perhaps it is some server setting that automatically makes $_POST['variable'] into $variable? I remember once when I changed servers, I had to change all my $_POST to $_REQUEST in some custom scripts I had. I don't know enough about server settings to suggest what to look for. You may want to post in the Server Configuration forum and maybe someone in there would know if there is some server setting that you may toggle/set that helps to pass your variables differently? George, or someone else in that forum, may know exactly what to do.

    Sorry I can't be of more help, Seanie.

    Leave a comment:


  • Seanie
    replied
    Originally posted by Lynne View Post
    They may be defined in the form, but when they get passed, they don't automatically become $type or $release_date. They get passed as $_POST['type'] and $_POST['release_date']. Those aren't the variables you are using though.
    they are now though?

    I dont understand how it could work before, its not isolated to this script, every other database adding script I have on the site isn't working in the same way. (apart from vBulletin)

    Leave a comment:


  • Lynne
    replied
    They may be defined in the form, but when they get passed, they don't automatically become $type or $release_date. They get passed as $_POST['type'] and $_POST['release_date']. Those aren't the variables you are using though.

    Leave a comment:


  • Seanie
    replied
    i never even noticed those before.

    But to answer your question they're defined in the form, when the user inputs into the form, hits submit it should carry it through to the database.


    changing them doesn't make any difference:

    INSERT INTO release_sched(act, title, type, release_date, taken_from) VALUES('', 'qq', '', '', '')

    Leave a comment:


  • Lynne
    replied
    OK, you have this line:
    Code:
    $query1 = "INSERT INTO $release_sched_db(act, title, type, release_date, taken_from) VALUES('$act1', '$title', '$type', '$release_date', '$taken_from')";
    You are only getting the title inserted. However, I can't find the other variables, $type, $release_date, etc, even defined. You have this:
    Code:
                $content = $_POST['type'];
    
                $contact = $_POST['release_date'];
    But that variables $contact and $content are not the ones you are using in your query. So, where are $type, $release_date, etc defined?

    Leave a comment:


  • Seanie
    replied
    just tried it, changed a few bits as you suggested and still getting the problem.

    Its getting a bit ridiculous now

    Leave a comment:


  • Lynne
    replied
    Have you tried running the page/form through an html validator? It could be that your server is more 'strict' than your other server and it doesn't like things like type="Submit" (the capitalized Submit isn't standard, it should be "submit"). That's just one small thing, but you may want to just run it through a validator and make sure it validates correctly.

    Leave a comment:


  • Seanie
    replied
    anyone got any idea, it'd suck if we had to go back to manually managing archives

    Leave a comment:


  • Seanie
    replied
    Sorry I've only just come back to you, I've been really busy with work and have only just had a chance to test this, and unfortunately i still only get:

    INSERT INTO release_sched(act, title, type, release_date, taken_from) VALUES('', 'Sean Testing Server', '', '', '')

    Leave a comment:


  • DoE
    replied
    Sorry, I been pretty busy, and have actually forgotten to check this forum for a few days.

    If I understand you right, the above code worked as intended on your old server, and on the new server it doesn't write the values into the DB? And you never modified it in any way?

    If so, your server may handle submmited form data differently. Try to use $_request, instead of $_post for reading in the data. In your form you have method="post" which is fine for submitting the form. But to read the data being submitted I use $_REQUEST['xxx']. E.g.: $username = $_REQUEST['username']. You may want to try that and see what happens.

    Leave a comment:


  • Seanie
    replied
    That form leads onto this page

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    
    <title>Urapopstar | The Original &amp; The Best</title>
    
    <link href="global.css" media="screen" type="text/css" rel="stylesheet" />
    
    <link rel="stylesheet" type="text/css" href="dropdown.css" />
    
    <script type="text/javascript" src="js/jquery-1.2.2.pack.js"></script>
    
    <script type="text/javascript" src="js/ddaccordion.js"></script>
    
    <script type="text/javascript" src="js/global.js"></script>
    
    </head>
    
    
    
    <body>
    
    <div id="wrapper">
    
        <?php include_once('side_nologin.php'); ?>
    
        
    
        <div id="main">
    
            <div id="content-panel">
    
                <h2>Submit A Release</h2>
    
                <div class="wide">
    
            <?php
    
                //$act = $_POST['actname'];
    
                //form not yet submitted
    
                //display add news form
    
                if (!$_POST['submit'])
    
                {
    
                ?>    
    
            <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
    
            <table width="400" border="0" cellspacing="0" cellpadding="3">
    
              <tr>
    
                <td align="right" nowrap="nowrap"><strong>Act Name:</strong></td>
    
                <td>
    
                <?php echo $_POST['actname']; ?><input name="act1" id="act1" type="hidden" value="<?php echo $_POST['actname']; ?>" size="50" maxlength="250" />
    
                </td>
    
              </tr>
    
              <tr>
    
                <td align="right" nowrap="nowrap"><strong>Release Title:</strong></td>
    
                <td><input size="50" maxlength="250" type="text" name="title" id="title" /></td>
    
              </tr>
    
              <tr>
    
                <td align="right" nowrap="nowrap"><strong>Release Type:</strong></td>
    
                <td>
    
                <select name="type" id="type"><br />
    
                    <option value="" selected>Select From List</option>
    
                    <option value="1">Single</option>
    
                    <option value="2">Album</option>
    
                </select>    
    
                </td>
    
              </tr>
    
              <tr>
    
                <td align="right" nowrap="nowrap"><strong>Release Date:</strong></td>
    
                <td>
    
            <?php
    
                include('includes/config.php');
    
                include('includes/functions.php');    
    
                chdir('/home/seanrobe/public_html/urapopstar/');     
    
                //Open a connection to the database
    
                $db = mysql_connect($hostname, $user, $pass) or die ('Error connecting to mysql');
    
                mysql_select_db($name) or die ('Error connecting to mysql');
    
                
    
                //generate and execute the sql query
    
                $query = "SELECT * FROM $release_date_db ORDER BY date ASC";
    
                    
    
                $result = mysql_query($query)
    
                or die ("Error in query: $query. " . mysql_error());
    
            
    
                //echo the drop down menu
    
                echo "<select name=\"release_date\" id=\release_date\"><br>";
    
                echo "<option value=\"\">Select From List</option>";
    
                
    
                    //if records are present
    
                    if (mysql_num_rows($result) > 0)
    
                    {
    
                        //iterate through results
    
                        //print title and links to edit and delete
    
                        while ($row = mysql_fetch_object($result))
    
                        {
    
                        ?>
    
                        <option value="<?php echo $row->date; ?>"><?php echo formatDate($row->date); ?></option>
    
                        <?php
    
                        }
    
                    //echo the closing tag for drop down menu
    
                    }
    
                echo "</select><br />";                    
    
            ?>    
    
                </td>
    
              </tr>
    
              <tr>
    
                <td align="right" nowrap="nowrap"><strong>Taken From:</strong></td>
    
                <td>
    
                <select name="taken_from" id="taken_from">
    
                    <option value="from current album">Current Album</option>
    
                    <option value="from forthcoming album">Forthcoming Album</option>
    
                    <option value="one off single">One off Single</option>
    
                </select>    
    
                </td>
    
              </tr>
    
              <tr>
    
                <td align="right">&nbsp;</td>
    
                <td><input type="Submit" name="submit" value="Add Release" /></td>
    
              </tr>
    
            </table>
    
            </form>
    
            
    
            <?php
    
            }
    
            else
    
            {
    
                chdir('/home/seanrobe/public_html/urapopstar');
    
                include('includes/config.php');
    
                include('includes/functions.php');
    
                
    
                //set up error list
    
                $errorList = array();
    
                
    
                //$act = $_POST['$act1'];
    
                $title = $_POST['title'];
    
                $content = $_POST['type'];
    
                $contact = $_POST['release_date'];
    
                
    
                //validate text input fields
    
                /*if (trim($_POST['act']) == '')
    
                {
    
                    $errorList[] = 'Invalid act';
    
                }*/    
    
                if (trim($_POST['title']) == '')
    
                {
    
                    $errorList[] = 'Invalid title';
    
                }
    
                
    
                if (trim($_POST['type']) == '')
    
                {
    
                    $errorList[] = 'Invalid release type';
    
                }    
    
                
    
                if (trim($_POST['release_date']) == '')
    
                {
    
                    $errorList[] = 'You have failed to select a release date.';
    
                }            
    
                
    
                //check for errors
    
                //if none are found...
    
                if (sizeof($errorList) == 0)
    
                {
    
                    //Open a connection to the database
    
                    chdir('/home/seanrobe/public_html/urapopstar');
    
                    $db = mysql_connect($hostname, $user, $pass) or die ('Error connecting to mysql');
    
                    mysql_select_db($name) or die ('Error connecting to mysql');    
    
                    
    
            /**
    
            act
    
            title
    
            type
    
            release_date
    
            taken_from
    
            */
    
                    
    
                    
    
                    //generate and execute query    
    
                    $query1 = "INSERT INTO $release_sched_db(act, title, type, release_date, taken_from) VALUES('$act1', '$title', '$type', '$release_date', '$taken_from')";
    
                    
    
                    $result = mysql_query($query1)
    
                    or die ("Error in query: $query1. " . mysql_error());
    
                    
    
                    //print result
    
                    echo '<font size="-1">Your release has been added... <a href="releases.php">Go to the release schedule...</a>.</font><br />';
    
                    echo  $query1;
    
                    //close the database connection
    
                    mysql_close($db);
    
                }
    
                else
    
                {
    
                    //errors found
    
                    //print a list
    
                    echo '<font size="-1">The following errors were found:';
    
                    echo '<br />';
    
                    echo '<ul>';
    
                    for ($x=0; $x<sizeof($errorList); $x++)
    
                    {
    
                        echo "<li>$errorList[$x]";
    
                    }
    
                    echo '</ul></font>';
    
                }
    
            }
    
            ?>            
    
            <br /><br />*If you are submitting a collaboration, please PM Izzy or Jake on the forums, as collaboration releases need to be entered manually by a site admin.
    
                </div>
    
            </div>    
    
    <br class="Clear" />    
    
    <?php
    
        // Get site config
    
        // include('../includes/config.php');
    
        // include('../includes/functions.php');
    
        
    
        // Open the database
    
        $db = mysql_connect($hostname, $user, $pass) or die ('Error connecting to mysql');
    
        mysql_select_db($name) or die ('Error connecting to mysql');    
    
        
    
        //generate and execute the sql query
    
        $id = $_GET['id'];
    
        
    
        $query = "SELECT id, name, content FROM $static_db WHERE name = '$id'";
    
        $result = mysql_query($query)
    
        or die ("Error in query: $query. " . mysql_error());
    
                        
    
        //if a result is returned
    
        if (mysql_num_rows($result) > 0)
    
            {
    
            //turn it into an object
    
            $row = mysql_fetch_object($result);
    
                            
    
            //print form with the values that can be edited
    
            include ('includes/content.php');
    
            }
    
            else
    
            {
    
                $query = "SELECT * FROM homepage";
    
                $result = mysql_query($query)
    
                or die ("Error in query: $query. " . mysql_error());
    
        
    
            //if a result is returned
    
            if (mysql_num_rows($result) > 0)
    
                {
    
                //turn it into an object
    
                $row = mysql_fetch_object($result);
    
        
    
                //print homepage
    
                ?>
    
            <!-- Charts -->
    
            <div id="content-panel" class="singles">
    
                <h2>Singles</h2>
    
                <div class="singles-img"><!-- Image --></div>
    
                <?php echo $row->singles; ?>
    
            </div>
    
            <div id="content-panel" class="albums">
    
                <h2>Albums</h2>
    
                <div class="albums-img"><!-- Image --></div>
    
                <?php echo $row->albums; ?>
    
            </div>
    
                <?php
    
                }                        
    
            }        
    
    ?>        
    
            <!-- Quick Links -->
    
            <div id="content-panel" class="quicklinks">
    
                <h2>Quick Links</h2>
    
                <div id="quick">
    
                <ul>
    
                    <li><a href="join.php">Join Urapopstar</a></li>
    
                    <li><a href="myuraps_submit.php">Submit A Release</a></li>
    
                    <li><a href="singles.php">Singles Chart</a></li>
    
                    <li><a href="albums.php">Albums Chart</a></li>
    
                    <li><a href="promote/index.php">Promote</a></li>
    
                </ul>
    
                </div>            
    
            </div>
    
            <br class="Clear" />
    
        </div>
    
        <br class="Clear" />
    
        <?php include_once('footer.php'); ?>
    
    </div>
    
    </body>
    
    </html>

    Leave a comment:


  • Seanie
    replied
    Originally posted by DoE View Post
    We'll use $act1 for an example. I can not see where you are giving it a value when the form is submitted, for example, where is:

    $act1 = $_REQUEST['act1'];

    You are obviously not getting DB errors, so if I overlooked something and $act1 is getting populated, then what I would do directly before writing the data to the DB is put this for testing:

    $act1 = 'worked';
    $title = 'worked too';

    etc for each variable. Run the script and check your DB to see if the words "worked", "worked too", are there. If they are then you know you the variables are not getting the appropriate data.
    Sorry I should have just posted the entire page in the first palce.

    the act is defined on the previous page from a form:

    HTML Code:
    <?php
    
       chdir('/home/seanrobe/public_html/urapopstar/promote'); 
    
       require_once('/home/seanrobe/public_html/urapopstar/promote/global.php'); 
    
       $uname = $vbulletin->userinfo['username']; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    
    <title>Urapopstar | The Original &amp; The Best</title>
    
    <link href="global.css" media="screen" type="text/css" rel="stylesheet" />
    
    <link rel="stylesheet" type="text/css" href="dropdown.css" />
    
    <script type="text/javascript" src="js/jquery-1.2.2.pack.js"></script>
    
    <script type="text/javascript" src="js/ddaccordion.js"></script>
    
    <script type="text/javascript" src="js/global.js"></script>
    
    </head>
    
    
    
    <body>
    
    <div id="wrapper">
    
        <?php include_once('side_nologin.php'); ?>
    
        
    
        <div id="main">
    
            <div id="content-panel">
    
                <h2>Submit A Release</h2>
    
                <div class="wide">
    
            <form action="myuraps_submit_release.php" method="post">
    
            <?php 
    
               if($uname == 'Unregistered')
    
               {
    
               echo "<span class='title'>ERROR</span><br /><br />You need to be logged in to submit a release.  Go back to the <a href=index.php>main page</a> and log in!";
    
               }
    
               else
    
               {
    
               echo "you are logged in as <strong>$uname</strong> is this the act you wish to submit a release for?<br />
    
               If not log out and log in as the act you are submitting for.<br /><br />
    
               If you do wish to submit for $uname then hit the button to proceed<br /><br />
    
               <input type=\"hidden\" value=\"$uname\" name=\"actname\" /><input type=\"submit\" value=\"Hit me\" /><br /><br />*If you are submitting a collaboration, please PM Izzy or Jake on the forums, as collaboration releases need to be entered manually by a site admin.";
    
               }
    
            ?>    
    
            </form>    
    
                </div>
    
            </div>    
    
    <br class="Clear" />    
    
    <?php
    
        // Get site config
    
        include('includes/config.php');
    
        
    
        // Open the database
    
        $db = mysql_connect($hostname, $user, $pass) or die ('Error connecting to mysql');
    
        mysql_select_db($name) or die ('Error connecting to mysql');    
    
        
    
        //generate and execute the sql query
    
        $id = $_GET['id'];
    
        
    
        $query = "SELECT id, name, content FROM $static_db WHERE name = '$id'";
    
        $result = mysql_query($query)
    
        or die ("Error in query: $query. " . mysql_error());
    
                        
    
        //if a result is returned
    
        if (mysql_num_rows($result) > 0)
    
            {
    
            //turn it into an object
    
            $row = mysql_fetch_object($result);
    
                            
    
            //print form with the values that can be edited
    
            include ('includes/content.php');
    
            }
    
            else
    
            {
    
                $query = "SELECT * FROM homepage";
    
                $result = mysql_query($query)
    
                or die ("Error in query: $query. " . mysql_error());
    
        
    
            //if a result is returned
    
            if (mysql_num_rows($result) > 0)
    
                {
    
                //turn it into an object
    
                $row = mysql_fetch_object($result);
    
        
    
                //print homepage
    
                ?>
    
            <!-- Charts -->
    
            <div id="content-panel" class="singles">
    
                <h2>Singles</h2>
    
                <div class="singles-img"><!-- Image --></div>
    
                <?php echo $row->singles; ?>
    
            </div>
    
            <div id="content-panel" class="albums">
    
                <h2>Albums</h2>
    
                <div class="albums-img"><!-- Image --></div>
    
                <?php echo $row->albums; ?>
    
            </div>
    
                <?php
    
                }                        
    
            }        
    
    ?>        
    
            <!-- Quick Links -->
    
            <div id="content-panel" class="quicklinks">
    
                <h2>Quick Links</h2>
    
                <div id="quick">
    
                <ul>
    
                    <li><a href="join.php">Join Urapopstar</a></li>
    
                    <li><a href="myuraps_submit.php">Submit A Release</a></li>
    
                    <li><a href="singles.php">Singles Chart</a></li>
    
                    <li><a href="albums.php">Albums Chart</a></li>
    
                    <li><a href="promote/index.php">Promote</a></li>
    
                </ul>
    
                </div>            
    
            </div>
    
            <br class="Clear" />
    
        </div>
    
        <br class="Clear" />
    
        <?php include_once('footer.php'); ?>
    
    </div>
    
    </body>
    
    </html>

    Leave a comment:


  • DoE
    replied
    We'll use $act1 for an example. I can not see where you are giving it a value when the form is submitted, for example, where is:

    $act1 = $_REQUEST['act1'];

    You are obviously not getting DB errors, so if I overlooked something and $act1 is getting populated, then what I would do directly before writing the data to the DB is put this for testing:

    $act1 = 'worked';
    $title = 'worked too';

    etc for each variable. Run the script and check your DB to see if the words "worked", "worked too", are there. If they are then you know you the variables are not getting the appropriate data.

    Leave a comment:


  • Seanie
    replied
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Urapopstar | The Original &amp; The Best</title>
    <link href="global.css" media="screen" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="dropdown.css" />
    <script type="text/javascript" src="js/jquery-1.2.2.pack.js"></script>
    <script type="text/javascript" src="js/ddaccordion.js"></script>
    <script type="text/javascript" src="js/global.js"></script>
    </head>
    
    <body>
    <div id="wrapper">
    	<?php include_once('side_nologin.php'); ?>
    	
    	<div id="main">
    		<div id="content-panel">
    			<h2>Submit A Release</h2>
    			<div class="wide">
    		<?php
    			//$act = $_POST['actname'];
    			//form not yet submitted
    			//display add news form
    			if (!$_POST['submit'])
    			{
    			?>	
    		<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
    		<table width="400" border="0" cellspacing="0" cellpadding="3">
    		  <tr>
    			<td align="right" nowrap="nowrap"><strong>Act Name:</strong></td>
    			<td>
    			<?php echo $_POST['actname']; ?><input name="act1" id="act1" type="hidden" value="<?php echo $_POST['actname']; ?>" size="50" maxlength="250" />
    			</td>
    		  </tr>
    		  <tr>
    			<td align="right" nowrap="nowrap"><strong>Release Title:</strong></td>
    			<td><input size="50" maxlength="250" type="text" name="title" id="title" /></td>
    		  </tr>
    		  <tr>
    			<td align="right" nowrap="nowrap"><strong>Release Type:</strong></td>
    			<td>
    			<select name="type" id="type"><br />
    				<option value="" selected>Select From List</option>
    				<option value="1">Single</option>
    				<option value="2">Album</option>
    			</select>	
    			</td>
    		  </tr>
    		  <tr>
    			<td align="right" nowrap="nowrap"><strong>Release Date:</strong></td>
    			<td>
    		<?php
    			include('includes/config.php');
    			include('includes/functions.php');	
    			chdir('/home/seanrobe/public_html/urapopstar/'); 	
    			//Open a connection to the database
    			$db = mysql_connect($hostname, $user, $pass) or die ('Error connecting to mysql');
    			mysql_select_db($name) or die ('Error connecting to mysql');
    			
    			//generate and execute the sql query
    			$query = "SELECT * FROM $release_date_db ORDER BY date ASC";
    				
    			$result = mysql_query($query)
    			or die ("Error in query: $query. " . mysql_error());
    		
    			//echo the drop down menu
    			echo "<select name=\"release_date\" id=\release_date\"><br>";
    			echo "<option value=\"\">Select From List</option>";
    			
    				//if records are present
    				if (mysql_num_rows($result) > 0)
    				{
    					//iterate through results
    					//print title and links to edit and delete
    					while ($row = mysql_fetch_object($result))
    					{
    					?>
    					<option value="<?php echo $row->date; ?>"><?php echo formatDate($row->date); ?></option>
    					<?php
    					}
    				//echo the closing tag for drop down menu
    				}
    			echo "</select><br />";					
    		?>	
    			</td>
    		  </tr>
    		  <tr>
    			<td align="right" nowrap="nowrap"><strong>Taken From:</strong></td>
    			<td>
    			<select name="taken_from" id="taken_from">
    				<option value="from current album">Current Album</option>
    				<option value="from forthcoming album">Forthcoming Album</option>
    				<option value="one off single">One off Single</option>
    			</select>	
    			</td>
    		  </tr>
    		  <tr>
    			<td align="right">&nbsp;</td>
    			<td><input type="Submit" name="submit" value="Add Release" /></td>
    		  </tr>
    		</table>
    		</form>
    		
    		<?php
    		}
    		else
    		{
    			chdir('/home/seanrobe/public_html/urapopstar');
    			include('includes/config.php');
    			include('includes/functions.php');
    			
    			//set up error list
    			$errorList = array();
    			
    			//$act = $_POST['$act1'];
    			$title = $_POST['title'];
    			$content = $_POST['type'];
    			$contact = $_POST['release_date'];
    			
    			//validate text input fields
    			/*if (trim($_POST['act']) == '')
    			{
    				$errorList[] = 'Invalid act';
    			}*/	
    			if (trim($_POST['title']) == '')
    			{
    				$errorList[] = 'Invalid title';
    			}
    			
    			if (trim($_POST['type']) == '')
    			{
    				$errorList[] = 'Invalid release type';
    			}	
    			
    			if (trim($_POST['release_date']) == '')
    			{
    				$errorList[] = 'You have failed to select a release date.';
    			}			
    			
    			//check for errors
    			//if none are found...
    			if (sizeof($errorList) == 0)
    			{
    				//Open a connection to the database
    				chdir('/home/seanrobe/public_html/urapopstar');
    				$db = mysql_connect($hostname, $user, $pass) or die ('Error connecting to mysql');
    				mysql_select_db($name) or die ('Error connecting to mysql');	
    				
    		/**
    		act
    		title
    		type
    		release_date
    		taken_from
    		*/
    				
    				
    				//generate and execute query	
    				$query1 = "INSERT INTO $release_sched_db(act, title, type, release_date, taken_from) VALUES('$act1', '$title', '$type', '$release_date', '$taken_from')";
    				
    				$result = mysql_query($query1)
    				or die ("Error in query: $query1. " . mysql_error());
    				
    				//print result
    				echo '<font size="-1">Your release has been added... <a href="releases.php">Go to the release schedule...</a>.</font><br />';
    				echo  $query1;
    				//close the database connection
    				mysql_close($db);
    			}
    			else
    			{
    				//errors found
    				//print a list
    				echo '<font size="-1">The following errors were found:';
    				echo '<br />';
    				echo '<ul>';
    				for ($x=0; $x<sizeof($errorList); $x++)
    				{
    					echo "<li>$errorList[$x]";
    				}
    				echo '</ul></font>';
    			}
    		}
    		?>			
    		<br /><br />*If you are submitting a collaboration, please PM Izzy or Jake on the forums, as collaboration releases need to be entered manually by a site admin.
    			</div>
    		</div>	
    <br class="Clear" />	
    <?php
    	// Get site config
    	// include('../includes/config.php');
    	// include('../includes/functions.php');
    	
    	// Open the database
    	$db = mysql_connect($hostname, $user, $pass) or die ('Error connecting to mysql');
    	mysql_select_db($name) or die ('Error connecting to mysql');	
    	
    	//generate and execute the sql query
    	$id = $_GET['id'];
    	
    	$query = "SELECT id, name, content FROM $static_db WHERE name = '$id'";
    	$result = mysql_query($query)
    	or die ("Error in query: $query. " . mysql_error());
    					
    	//if a result is returned
    	if (mysql_num_rows($result) > 0)
    		{
    		//turn it into an object
    		$row = mysql_fetch_object($result);
    						
    		//print form with the values that can be edited
    		include ('includes/content.php');
    		}
    		else
    		{
    			$query = "SELECT * FROM homepage";
    			$result = mysql_query($query)
    			or die ("Error in query: $query. " . mysql_error());
    	
    		//if a result is returned
    		if (mysql_num_rows($result) > 0)
    			{
    			//turn it into an object
    			$row = mysql_fetch_object($result);
    	
    			//print homepage
    			?>
    		<!-- Charts -->
    		<div id="content-panel" class="singles">
    			<h2>Singles</h2>
    			<div class="singles-img"><!-- Image --></div>
    			<?php echo $row->singles; ?>
    		</div>
    		<div id="content-panel" class="albums">
    			<h2>Albums</h2>
    			<div class="albums-img"><!-- Image --></div>
    			<?php echo $row->albums; ?>
    		</div>
    			<?php
    			}						
    		}		
    ?>		
    		<!-- Quick Links -->
    		<div id="content-panel" class="quicklinks">
    			<h2>Quick Links</h2>
    			<div id="quick">
    			<ul>
    				<li><a href="join.php">Join Urapopstar</a></li>
    				<li><a href="myuraps_submit.php">Submit A Release</a></li>
    				<li><a href="singles.php">Singles Chart</a></li>
    				<li><a href="albums.php">Albums Chart</a></li>
    				<li><a href="promote/index.php">Promote</a></li>
    			</ul>
    			</div>			
    		</div>
    		<br class="Clear" />
    	</div>
    	<br class="Clear" />
    	<?php include_once('footer.php'); ?>
    </div>
    </body>

    Leave a comment:


  • Seanie
    replied
    Oh yrah sorry they're pulled from a form that's just before this code. I just noticed I hadn't copied the complete script. It worked fine on my previous server, I'm wondering if I need to update the syntax for a newer version of mysql


    I'm on my phone so can't post the missing part of the script.... Will post it as soon as I get on my laptop

    Leave a comment:

widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X