Major issues with a mod I'm doing with the install file. Anyone a professional?

Discussion in 'PHP' started by Laceygirl, Jan 30, 2009.

  1. #1
    Ok, I am an arcade script provider and I've been working with the arcade scirpt but I cannot get the install file to work.
    This may get a little complicated if you are not a pro, but bare with me.
    I wanted to make it so that people can type in their keywords and description for their metatag directly in the arcade admin section instead of editing the file. I'll show the steps here, and let you know the problem after.

    When I put in a test arcade I used the normal installer files and then put in the changes after along with the two new SQL entries. Here's what I did:

    1. I replaced the normal meta tag with the code:
    (templates/V3/index.php)
    -------------------------------------------
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" href="<? echo "$site_url$template_url"?>/style.css" type="text/css">
    <title><? echo "".$site_name." - "; include('./modules/content_title.php');?></title>
    <META NAME="description" CONTENT="<? echo "$site_description" ?>">
    <META NAME="keywords" CONTENT="<? echo "$site_keywords" ?>">


    2. Then I placed it into the spot where people can change it in their admin area
    (admin/settings.php)
    ------------------------------------------------------
    <td width="50%" bgcolor="#E0E0E0"><div align="left"><span class="style2">Site name </span></div></td>
    <td bgcolor="#EEEEEE"><label>
    <div align="left">
    <input name="site_name" type="text" id="site_name" value="<? echo $row['site_name']; ?>" size="32" />
    </div>
    </label></td>
    </tr>
    <tr>
    <td width="50%" bgcolor="#E0E0E0"><div align="left"><span class="style2">Meta Description </span></div></td>
    <td bgcolor="#EEEEEE"><label>
    <div align="left">
    <input name="site_description" type="text" id="site_description" value="<? echo $row['site_description']; ?>" size="32" />
    </div>
    </label></td>
    </tr>
    <tr>
    <td width="50%" bgcolor="#E0E0E0"><div align="left"><span class="style2">Meta Keywords(separated by comma's) </span></div></td>
    <td bgcolor="#EEEEEE"><label>
    <div align="left">
    <input name="site_keywords" type="text" id="site_keywords" value="<? echo $row['site_keywords']; ?>" size="32" />
    </div>
    </label></td>
    </tr>

    <tr>
    <td bgcolor="#E0E0E0"><div align="left"><span class="style2">Site URL </span></div></td>
    <td bgcolor="#EEEEEE"><label>
    <div align="left">
    <input name="site_url" type="text" id="site_url" value="<? echo $row['site_url']; ?>" size="32" />



    3. Now I put in the info in the Config.php file
    ----------------------------------------------------
    $sql = mysql_query("SELECT * FROM ava_settings");
    $row = mysql_fetch_array($sql);
    $site_name = $row['site_name'];
    $site_description = $row['site_description'];
    $site_keywords = $row['site_keywords'];

    $site_url = $row['site_url'];
    $seo_on = $row['seo_on'];
    $template_url = $row['template_url'];
    $max_results = $row['max_results'];
    $image_height = $row['image_height'];
    $image_width = $row['image_width'];
    $adsense = $row['adsense'];
    $cat_numbers = $row['cat_numbers'];


    4. Now I manually put in the sql stuff. I won't show you that because its not important. After all of this it WORKED. So I thought this was going to be great because this is the beggining of many upgrades I can easily do now.

    HERE'S MY PROBLEM:

    The install file is not working for me. I remember having much difficulty with in the past and it won't work.

    1. I added the proper setup for the sql inserting:
    (in the install/sql1.php folder)
    ------------------------------------------------------
    $sql7 = 'CREATE TABLE `ava_settings` ('
    . ' `site_name` text NOT NULL,'
    . ' `site_description` text NOT NULL,'
    . ' `site_keywords` text NOT NULL,'
    . ' `site_url` text NOT NULL,'
    . ' `template_url` text NOT NULL,'
    . ' `max_results` text NOT NULL,'
    . ' `image_height` text NOT NULL,'
    . ' `image_width` text NOT NULL,'
    . ' `adsense` char(1) NOT NULL default \'\','
    . ' `cat_numbers` char(1) NOT NULL default \'\','
    . ' `seo_on` char(1) NOT NULL default \'\','

    2. I added in the entry so that people can add in the information themselves when installing. at the end of the script installation it asks a few questons.
    (install/new_site.html)
    --------------------------------------------------------
    <p>Site info(please fill out everything, as it can be changed later):</p>
    <form id="form1" name="form1" method="post" action="new_site.php">
    <label>Site name:
    <input name="site_name" type="text" id="site_name" value="PH Arcade Premium" />
    </label>
    <p>
    <label>PH Arcade root url(important!!):
    <input name="site_url" type="text" id="site_url" value="http://" />
    </label>
    </p>
    <form id="form1" name="form1" method="post" action="new_site.php">
    <label>Meta Description:
    <input name="site_description" type="text" id="site_description" value="Type in what your site is about" />
    </label>
    <p>
    <label>Meta Keywords:
    <input name="site_keywords" type="text" id="site_keywords" value="For, example, such, as, this," />
    </label>
    </p>



    So now on a fresh install the new mod should be there. Its just so easy..........Not really becuase it will not let me do it in the end of the installing after you put in all of the last information and click after the new_site.html it shows this error:
    Settings were not imported: Column count doesn't match value count at row 1
    Come to think of it, while I was writing this I realized that the spot I put blue looks wrong(like it shouldn't be there). I'll check that out.


    My questions are simple:
    Does anyone see anything wrong with this coding?
    Am I missing something?

    Here is the edited files for you to check out if you want:
    http://www.pharcade.com/temp/Originalfiles.zip

    And if you are feeling really bored you can grab the basic arcade which is free and install it and see what I'm doing wrong.
    http://www.pharcade.com/packages/basic.zip


    Please offer assistance. I'm stuck and got no one to turn to
     
    Laceygirl, Jan 30, 2009 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    Wich file is displaying the error?
     
    EricBruggema, Jan 30, 2009 IP
  3. Laceygirl

    Laceygirl Notable Member

    Messages:
    4,617
    Likes Received:
    188
    Best Answers:
    1
    Trophy Points:
    250
    #3
    I did figure this out now.

    The No #1 I mentioned just was put in the wrong spot. I should've brought the two codes down one spot.

    This is solved.
     
    Laceygirl, Jan 31, 2009 IP
  4. Gonzo4u

    Gonzo4u Well-Known Member

    Messages:
    410
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #4
    Hello GrAveTzT,

    In your #1
    you forgot to add a ; and put your variables into single quote if double quotes are used outside. Always use a <?php tag instead of short tag <? for most compatibility.

    It should be like this
    <META NAME="description" CONTENT="<?php echo '$site_description'; ?>">
    <META NAME="keywords" CONTENT="<?php echo '$site_keywords'; ?>">


    This is the only error I could figure out from your post. Rest if you can explain what exactly is causing error or where you are getting stuck let me know, send me your complete source files to have a look.

    Regards,
    Gonzo
     
    Gonzo4u, Jan 31, 2009 IP
  5. Laceygirl

    Laceygirl Notable Member

    Messages:
    4,617
    Likes Received:
    188
    Best Answers:
    1
    Trophy Points:
    250
    #5
    thanks Gonzo.

    I'm going to check into the <?php straight away but I'm guessing its not going to work by changing it because now it is working.
     
    Laceygirl, Jan 31, 2009 IP
  6. Gonzo4u

    Gonzo4u Well-Known Member

    Messages:
    410
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #6
    You are welcome!

    By Compatibility I mean to say with PHP versions and deployment compatibility and not with the codes. If your codes are having any errors in them this won't resolve your issue, you will need to check and correct your codes.

    Regards,
    Gonzo
     
    Gonzo4u, Feb 1, 2009 IP