Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8922457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:50:21+00:00 2026-06-15T06:50:21+00:00

I am using mysql database for my phonegap app but phonegap don’t support php

  • 0

I am using mysql database for my phonegap app
but phonegap don’t support php language ..

var input = $(‘#input’);

$.ajax({
    url: 'http://localhost/postdetail/photo.php',
    dataType: 'jsonp',
    jsonp: 'jsoncallback',
    timeout: 5000,
    success: function(data, status){
        $.each(data, function(i,item){ 
            var photo = '<h1>'+item.name+'</h1>'
            + '<p>'+item.id+'<br>'+
            '<h3>'+item.img+'</h3><br>'+
            '<img  src="'+item.img+'">';
            input.append(photo);



        });
    },

Blob Image in Mysql Don’t Display .. plese Help Me

my php script

<?php
header('Content-type: application/json');

$server = "localhost:3306";
$username = "root";
$password = "12345";
$database = "photos";

$con = mysql_connect($server, $username, $password) or die ("Could not connect: " . mysql_error());
mysql_select_db($database, $con);

$sql = "SELECT id, name AS name, img AS img  FROM n ORDER BY name";
$result = mysql_query($sql) or die ("Query error: " . mysql_error());

$records = array();

while($row = mysql_fetch_assoc($result)) {
    $records[] = $row;
}

mysql_close($con);

echo $_GET['jsoncallback'] . '(' . json_encode($records) . ');';
?>

Thanx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:50:22+00:00Added an answer on June 15, 2026 at 6:50 am

    If you’re trying to embed the image directly, you’ll need to use the data: format

    <img src="data:img/png,base64,<?= $base_64_encoded_image_data ?>" />
    

    Or in your case: run base64_encode() on your blob in your php script, then do this in your javascript:

        var photo = '<h1>'+item.name+'</h1>'
        + '<p>'+item.id+'<br>'+
        '<h3>'+item.img+'</h3><br>'+
        '<img  src="data:image/png,base64,'+item.img+'">';
        input.append(photo);
    

    Of course, you’ll need to make sure the mime type matches; if you aren’t using pngs exclusively, you’ll have to pass along the mime type as well in your ajax response.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My rails app is set up using a mysql database. When I do a
I am accessing a MySQL database within a C++ app using MySQL C++ Connector.
I've been using mysql database to database management system but I found errors with
I usually store dates as integers using PHP's time() function in a MySQL database
In PHP, I am escaping characters before insert in a MySQL database using mysql_real_escape_string
What's the best way to convert a PHP web app (with server-side MySQL database
I'm trying to connect to a mysql database using Connector/J but get the same
im doing a PHP project using codeigniter 2.1.2 , using mySql database on WAMP,
I'm using Mysql database and neatbeans IDE conncting by mysql-connector-java-5.1.21 jdbc , and I
I was using Mysql database before and decided to switch to Postgresql and now,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.