Jump to content

timmah1

Members
  • Posts

    1,170
  • Joined

  • Last visited

Posts posted by timmah1

  1. Thank you for your help, but I'm getting different errors now that I've never seen before

    Uncaught RangeError: Maximum call stack size exceeded
    
    And I have no idea how to fix that. Even reading about it, i'm totally clueless

     

    Thank you for your help, it is really appreciated!

  2. Like this:

    [{"lat":"","lng":"","name":"Lobster Louie's Truck","address":"300 Pine, San Francisco, CA 94104","place":"300 Pine","hours":"8:00am - 10:00am","location":"Located at the corner of pine and 3rd."},{"lat":"","lng":"","name":"Lobster Louie's Truck","address":"Terry Francois Blvd, San Francisco, CA","place":"The Yard at Mission Rock","hours":"11:00am - 3:00pm","location":"Located at the Yard"}]
    
    But the map isn't populating, so I guess I was just assuming that the php code is at fault
  3. Maybe I'm doing this entire thing wrong.

     

    The code I'm using is this:

    var markersData = [
    <?php
    $sql = "SELECT * FROM events";
    $result = $conn->query($sql);
     
    while($row = $result->fetch_assoc()) {
     
    	$events[] = array(		
    			'lat'		=> $row['event_lat'],
    			'lng' 		=> $row['event_lng'],
    			'name' 		=> $row['event_name'],
    			'address'	=> $row['event_address'],
    			'place'		=> $row['event_place'],
    			'hours' 	=> $row['event_hours'],
    			'location'	=> $row['event_location']
    	);
    }
    	echo json_encode($events); 
    ?>
    ];
    Is this not the proper way to do this?

    I'm using php on the javascript file

  4. So, essentially it would be this:

     

    $sql = "SELECT * FROM events";
    $result = $conn->query($sql);
     
    while($row = $result->fetch_assoc()) {
     
    	$events[] = array(		
    			'lat'		=> $row['event_lat'],
    			'lng' 		=> $row['event_lng'],
    			'name' 		=> $row['event_name'],
    			'address'	=> $row['event_address'],
    			'place'		=> $row['event_place'],
    			'hours' 	=> $row['event_hours'],
    			'location'	=> $row['event_location']
    	);
    }
    	echo json_encode($events);
    
    to output like so

    {
          lat: 40.6386333,
          lng: -8.745,
          name: "xxxx",
    	  address: "xxxx",
    	  place: "xxxxx",
    	  hours: "xxxxx",
          location: "xxxx"
       },
       {
          lat: 40.59955,
          lng: -8.7498167,
          name: "xxxx",
    	  address: "xxxx",
    	  place: "xxxxx",
    	  hours: "xxxxx",
          location: "xxxx"
       },
       {
          lat: 40.6247167,
          lng: -8.7129167,
          name: "xxxx",
    	  address: "xxxx",
    	  place: "xxxxx",
    	  hours: "xxxxx",
          location: "xxxx"
       }
    
  5. This is something small that I'm forgetting, but I'm lost now.

     

    I need to get the information from the db to display as follows:

     

    var markersData = [
       {
          lat: 40.6386333,
          lng: -8.745,
          name: "xxxx",
     address: "xxxx",
     place: "xxxxx",
     hours: "xxxxx",
          location: "xxxx"
       },
       {
          lat: 40.59955,
          lng: -8.7498167,
          name: "xxxx",
     address: "xxxx",
     place: "xxxxx",
     hours: "xxxxx",
          location: "xxxx"
       },
       {
          lat: 40.6247167,
          lng: -8.7129167,
          name: "xxxx",
     address: "xxxx",
     place: "xxxxx",
     hours: "xxxxx",
          location: "xxxx"
       }
    ];
    
     

    Now, my query is this:

     

    $sql = "SELECT * FROM events";
    $result = $conn->query($sql);
    while($row = $result->fetch_assoc()) {
    
    $events[] = array( 
    'lat' => $row['event_lat'],
    'lng'  => $row['event_lng'],
    'name'  => $row['event_name'],
    'address' => $row['event_address'],
    'place' => $row['event_place'],
    'hours'  => $row['event_hours'],
    'location' => $row['event_location']
    );
    echo '<pre>'.print_r($events); 
    }
    
     

    Which prints out this:

     

    Array
    (
        [0] => Array
            (
                [lat] => 
                [lng] => 
                [name] => Lobster Louie's Truck
                [address] => 300 Pine, San Francisco, CA 94104
                [place] => 300 Pine
                [hours] => 8:00am - 10:00am
                [location] => Located at the corner of pine and 3rd.
            )
    
    )
    Array
    (
        [0] => Array
            (
                [lat] => 
                [lng] => 
                [name] => Lobster Louie's Truck
                [address] => 300 Pine, San Francisco, CA 94104
                [place] => 300 Pine
                [hours] => 8:00am - 10:00am
                [location] => Located at the corner of pine and 3rd.
            )
    
        [1] => Array
            (
                [lat] => 
                [lng] => 
                [name] => Lobster Louie's Truck
                [address] => Terry Francois Blvd, San Francisco, CA
                [place] => The Yard at Mission Rock
                [hours] => 11:00am - 3:00pm
                [location] => Located at the Yard
            )
    
    )
    
     

     

    I do not understand why it's showing 3, when there is only 2 in the database, but regardless, it's not working anyhow.

     

    Can somebody please see what's wrong so that it formats correctly?

     

    Thanks

  6. Sorry, I noticed that after I posted it

     

    I have this

     

    $sql = "SELECT * FROM schedule as t1
    inner join 
    teams as t2
    on t1.schedule_home=t2.team_id
    inner join
    team as t3
    on t1.schedule_away=t3.teams_id WHERE t1.schedule.date > '$today' OR t1.schedule.date < '$week' ";
  7. Im getting the same results doing this

     

    $sql = "SELECT * FROM schedule as t1
    inner join 
    teams as t2
    on t1.schedule_home=t2.team_id
    inner join
    team as t3
    on t1.schedule_away=t3.teams_id WHERE t4.schedule.date > '$today' OR t1.schedule.date < '$week' ";
    
  8. Yes, it is teams_id and team_id, those are correct.

     

    This always returns nothing, no games found, but there are games, 8 of them, on September 2nd.

     

    It works if i don't try to grab dates in between 2 dates, so that's why I'm not sure what is wrong.

  9. Can somebody help me as to why I'm not getting any results?

    $today = date("Y-m-d");
    
    $week = date("Y-m-d", strtotime("+7 day"));
    
     
    
    $sql = "SELECT * FROM schedule as t1
    
    inner join 
    
    teams as t2
    
    on t1.schedule_home=t2.team_id
    
    inner join
    
    team as t3
    
    on t1.schedule_away=t3.teams_id 
    
    inner join
    
    schedule as t4
    
    on t4.schedule.date > '$today' WHERE t1.schedule.date < '$week' ";
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {
    echo 'Results';
    } else {
    echo 'No Upcoming Games';
    }
    
    

    I'm trying to get all games that are greater than today's date, but  less than 7 days from now

  10. Your right, it says 

    Warning: Cannot modify header information - headers already sent by (output started at index.php:1) in /index.php on line 9

    Line 9 is the redirect.

     

    I don't understand what else to do

  11. ok, I have this now

    I get on error on Line 9 that headers were already sent (which is header('Location:admin-login.php')

    Nothing is output before my session_start()

    session_start();
    include 'assets/config.php';
     
    error_reporting(E_ALL);
    ini_set('display_errors', '1');
     
    if(empty($_SESSION['user'])) {
        header('Location: admin-login.php');
    exit;
    }
    
  12. Can anybody tell me why this is not working?

    session_start();
    if (!isset($_SESSION['user'])) {
    header('Location: admin-login.php');
    }
    
     
    No session is set, yet I can still view the page.
    I get no errors or anything.
     
    I'm at a loss because I've used this same thing for a lot of sites, and all of those work
  13. I'm trying to get info from my database into an event calendar, but I'm lost as to what I need to do here.
    Can anybody help me out?
     
    Thanks in advance
     
     
    $sql = "SELECT * FROM events";
    $result = $connection->query($sql);
     
    while($row = $result->fetch_assoc()){
     
    $events = array( 
     
             array(
    'id' => $row['id'],
    'title' => $row['event'],
    'start' => $row['eventDate']
    )
    );
    echo json_encode($events); 
    }
    
    ?>
    This currently shows results like this
    [{"id":"1018","title":"Free Lunch Friday","start":"2016-01-29 12:30:00"}][{"id":"1020","title":"College Football Championship Game","start":"2016-01-11 00:00:00"}]
    
     
    I want to be like this
        array(
            'id' => $row['id'],
            'title' => $row['event'],
            'start' => $row['eventDate']
        ),
        array(
            'id' => $row['id'],
            'title' => $row['event'],
            'start' => $row['eventDate']
        )
    

     

  14. Sorry to bring this topic back up, but I'm stuck once again

     

    To loop through members

     

    I have this

    but it's obviously not right because I keep getting invalid argument 

    Plus, it's only showing 1 for the crew members,

    $i = 0;
    $crew_comm = $data->data->hierarchy->Data->Ranks[1]->Members[$i]->Name;
     
    foreach($crew_comm as $result){
    $i++;
        echo($result->Name);
    }
    
  15. I'm trying to show information from an API with PHP.

    I can get the info, but how do I break the results down for display purposes?

    $json_url = "http://socialclub.rockstargames.com/crewapi/crew_name/hierarchy/100/false";
    $json = file_get_contents($json_url);
    $json=str_replace('},
     
    ]',"}
     
    ]",$json);
    $data = json_decode($json);
     
    echo "<pre>";
    print_r($data);
    echo "</pre>";
    
     
    All the data is shown like this
    stdClass Object
    
    (
    
    [data] => stdClass Object
    
    (
    
    [hierarchy] => stdClass Object
    
    (
    
    [Data] => stdClass Object
    
    (
    
    [Total] => 35
    
    [CrewId] => 0159
    
    [CrewName] => Crew Name
    
    [CrewTag] => Dead
    
    [CrewColor] => #03f2ff
    
    [IsLeader] =>
    
    [MyRank] => -1
    
    [Ranks] => Array
    
    (
    
    [0] => stdClass Object
    
    (
    
    [RankName] => leader
    
    [RankNamePlural] => leader
    
    [Description] => The Crew founder and head honcho. Their power is absolute.
    
    [RankOrder] => 0
    
    [RankMemberCount] => 1
    
    [SystemFlags] => 9223372036854775807
    
    [Permissions] => Array
    
    (
    
    [0] => Kick members
    
    [1] => Invite new members
    
    [2] => Promote members
    
    [3] => Demote members
    
    [4] => Manage role permissions
    
    [5] => Publish multiple emblems
    
    [6] => Write on wall
    
    [7] => Delete emblems and wall posts
    
    [8] => Edit settings
    
    [9] => View settings page
    
    [10] => Post in-game messages
    
    [11] => Update status
    
    )
    
    

    Thanks in advacne

  16. I'm trying to get this cart working quickly.

     

    Everything works except when adding things to cart, I keep getting this error

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
    

    This is the page that the error is generating from

    <?php
    function pf_validate_number($value, $function, $redirect) {
    if(isset($value) == TRUE) {
    if(is_numeric($value) == FALSE) {
    $error = 1;
    }
    if(@$error == 1) {
    header("Location: " . $redirect);
    }
    else {
    $final = $value;
    }
    }
    else {
    if($function == 'redirect') {
    header("Location: " . $redirect);
    }
    if($function == "value") {
    $final = 0;
    }
    }
    return $final;
    }
     
     
    function showcart()
    {
    if(isset($_SESSION['SESS_ORDERNUM']))
    {
    if(isset($_SESSION['SESS_LOGGEDIN']))
    {
    $custsql = "SELECT id, status from orders WHERE customer_id = ". $_SESSION['SESS_USERID']. " AND status < 2;";
    $custres = mysql_query($custsql)or die(mysql_error());;
    $custrow = mysql_fetch_assoc($custres);
     
    $itemssql = "SELECT products.*, orderitems.*, orderitems.id AS itemid FROM products, orderitems WHERE orderitems.product_id =products.id AND order_id = " . $custrow['id'];
    $itemsres = mysql_query($itemssql)or die(mysql_error());;
    $itemnumrows = mysql_num_rows($itemsres);
    }
    else
    {
    $custsql = "SELECT id, status from orders WHERE session = '" . session_id(). "' AND status < 2;";
    $custres = mysql_query($custsql)or die(mysql_error());;
    $custrow = mysql_fetch_assoc($custres);
    $itemssql = "SELECT products.*, orderitems.*, orderitems.id AS itemid FROM products, orderitems WHERE orderitems.product_id = products.id AND order_id = " . $custrow['id'];
    $itemsres = mysql_query($itemssql)or die(mysql_error());;
    $itemnumrows = mysql_num_rows($itemsres);
     
    }
    }
    else
    {
    $itemnumrows = 0;
    }
    if($itemnumrows == 0)
    {
    echo "You have not added anything to your shopping cart yet.";
    }
     
    else
    {
    echo "<table cellpadding='10'>";
    echo "<tr>";
    echo "<td></td>";
    echo "<td><strong>Item</strong></td>";
    echo "<td><strong>Quantity</strong></td>";
    echo "<td><strong>Unit Price</strong></td>";
    echo "<td><strong>Total Price</strong></td>";
    echo "<td></td>";
    echo "</tr>";
    while($itemsrow = mysql_fetch_assoc($itemsres))
    {
    $quantitytotal = $itemsrow['price'] * $itemsrow['quantity'];
    echo "<tr>";
    if(empty($itemsrow['image'])) {
    echo "<td><img src='productimages/dummy.jpg' width='50' alt='" . $itemsrow['name'] . "'></td>";
    }
    else {
    echo "<td><img src='productimages/" .$itemsrow['image'] . "' width='50' alt='". $itemsrow['name'] . "'></td>";
    }
    echo "<td>" . $itemsrow['name'] . "</td>";
    echo "<td>" . $itemsrow['quantity'] . "</td>";
    echo "<td><strong>£" . sprintf('%.2f', $itemsrow['price']) . "</strong></td>";
    echo "<td><strong>£". sprintf('%.2f', $quantitytotal) . "</strong></td>";
    echo "<td>[<a href='delete.php?id=". $itemsrow['itemid'] . "'>X</a>]</td>";
    echo "</tr>";
    @$total = $total + $quantitytotal;
    $totalsql = "UPDATE orders SET total = ". $total . " WHERE id = ". $_SESSION['SESS_ORDERNUM'];
    $totalres = mysql_query($totalsql)or die(mysql_error());;
    }
    echo "<tr>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<td>TOTAL</td>";
    echo "<td><strong>£". sprintf('%.2f', $total) . "</strong></td>";
    echo "<td></td>";
    echo "</tr>";
    echo "</table>";
    echo "<p><a href='checkout-address.php'>Go to the checkout</a></p>";
    }
    }
    ?>
    
     
    I cannot for the life of me figure out where this error is.
     
    Can somebody please help me out??
     
    Thank you in advance
  17. Thank you for the reply, but it's not giving the desired results, everything is returned like this:

     

     

    	
    		
    			
    				Array
    		
    		
    			
    				 
    			
    				(
    		
    		
    			
    				 
    			
    				[0] => <h2 style="text-align: center;"><span style="text-decoration: underline;">Alabama Tattoo Shops</span></h2>
    		
    		
    			
    				 
    			
    				<hr style="border: 4px outset #DC143C;"/>
    		
    		
    			
    				 
    			
    				<p style="text-align: center;">A-1 Port City Tattooing & Body</p>
    		
    		
    			
    				 
    			
    				<p style="text-align: center;">5775 Gunn Rd</p>
    		
    		
    			
    				 
    			
    				<p style="text-align: center;">Mobile AL 36619</p>
    		
    		
    			
    				 
    			
    				<p style="text-align: center;">(251) 591-0846</p>
    		
    		
    			
    				 
    			
    				<hr style="border: 4px outset #DC143C;"/>
    		
    		
    			
    				 
    			
    				<p style="text-align: center;">Abro Inkworks</p>
    		
    		
    			
    				 
    			
    				<p style="text-align: center;">540 Main St</p>
    		
    		
    			
    				 
    			
    				<p style="text-align: center;">E Rainsville AL 35986</p>
    		
    		
    			
    				 
    			
    				<p style="text-align: center;">(256) 638-8360</p>
    		
    		
    			
    				 
    			
    				<hr style="border: 4px outset #DC143C;"/>
    				

     

    Everything seems to be in the single Array[0]

     

    You can see what I'm talking about here

    http://slapbackstudio.com/scrape.php

  18. I have a site that everything was typed manually, but I want to get all this info off so I can put all info into a database for easier editing and so forth.

     

    I'm trying this code, which works to a point.

    function curl($Url){
      
        if (!function_exists('curl_init')){
            die('cURL is not installed. Install and try again.');
        }
      
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $Url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $output = curl_exec($ch);
    curl_close($ch); 
     
    $start = strpos($output, '<h2 style="text-align: center;"><span style="text-decoration: underline;">Alabama Tattoo Shops</span></h2>');
    $end = strpos($output, '<p>', $start);
    $length = $end-$start;
    $site = substr($output, $start, $length);
     
    $site = explode("<p>", $site);
     
    foreach ($site AS $line) {
     
        print_r($line);
      }
     
        return $output; 
    }
    $site = curl('http://www.tattooshopusa.com/alabama/');
    
     
    I don't understand how I can take the output and put the info into variables for easy insertion into the database.
     
    Any help would be greatly appreciated.
     
    Thanks in advance for your help
  19. I'm trying to create rules to make the urls "pretty", but also use dynamic subdomains. I can only get one or the other to work

     

    For example:

    I want the url to show

    http://abc.example.com/category, and

     

    but the script will actually access

    http://example.com/page.php?short=category&sub=abc

     

    How can I do this together?

     

    I already set up a dns entry for wildcard subdomains

     

    Here is what I have so far, but this is not working, I keep getting a 404 Error

     

    Any help would be greatly apprecaited

    Options +FollowSymLinks
     
    RewriteEngine On 
     
    RewriteCond %{SCRIPT_FILENAME} !-d  
    RewriteCond %{SCRIPT_FILENAME} !-f 
    RewriteRule ^(\w+)$ ./page.html?short=$1
    RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
    RewriteCond %{HTTP_HOST} ^([a-zA-Z0-9]+)\.example\.com$ [NC]
    
    
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.